aspose file tools*
The moose likes Beginning Java and the fly likes POI File Not Compiling Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "POI File Not Compiling Problem" Watch "POI File Not Compiling Problem" New topic
Author

POI File Not Compiling Problem

Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Hi friends,
I am using POI In order to import the excel data's into MySQL using Java. I just write a simple program and placed it in jdk\bin folder and it compiles too. But, when i copy the same Java File and placed it in WEB-INF folder of my project (I need to get the excel file online) and try to compiled, but it doesn't... What is the problem...

Here is the command i used to compile the Java file...
This one is for when i place the file in jdk bin folder..
javac -classpath c:\java\jdk1.6\lib\poi-3.5-beta1-20080718.ja
r;C:\java\jdk1.6\bin ReadExcel.java
Note: ReadExcel.java uses or overrides a deprecated API.
Note: Recompile with -Xlint eprecation for details.


This one is when i put that file in WEB-INF folder...
javac -classpath c:\apache-tomcat-6.0.16\lib\poi-3.5-beta1-20080718.jar;C:\apa
che-tomcat-6.0.16\webapps\rmanew\WEB-INF\classes ReadExcel.java

This gives me an error like this
'javac' is not recognized as an internal or external command,
operable program or batch file.


Please help me ranchers...


Never try to be a hard-worker. Be a smart-worker.
My Blog
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

Hi,

The problem is because the javac.exe file could not be located. I would not call it a compilation error. Add the jdk/bin folder to the PATH variable (in windows environment) or try the same same command from the jdk/bin folder.

Cheers,
Raj.
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Originally posted by Raj Kamal:
Hi,

The problem is because the javac.exe file could not be located. I would not call it a compilation error. Add the jdk/bin folder to the PATH variable (in windows environment) or try the same same command from the jdk/bin folder.

Cheers,
Raj.


As i said earlier, i am able to compile that file in the jdk's bin folder and not in the WEB-INF folder... If i add the jdk\bin in tha classpath will it works. My current classpath you have noticed in my previous post... Please help me
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

Hi,

My guess would be the ReadExcel.java file compiles when put in the jdk/bin folder because that is where is javac.exe file is present. When you move it to the WEB-INF folder it is not able to find the javac.exe file. That is why I mentioned about the PATH variable. Add the jdk/bin in the PATH environmental variable and execute the same command. Then it should be able to locate the javac.exe file. Don't think this is a CLASSPATH issue.

Cheers,
Raj.
[ October 06, 2008: Message edited by: Raj Kamal ]
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Originally posted by Raj Kamal:
Hi,

My guess would be the ReadExcel.java file compiles when put in the jdk/bin folder because that is where is javac.exe file is present. When you move it to the WEB-INF folder it is not able to find the javac.exe file. That is why I mentioned about the PATH variable. Add the jdk/bin in the PATH environmental variable and execute the same command. Then it should be able to locate the javac.exe file.

Cheers,
Raj.


Dude, when i use the below command in WEB-INF folder,it works and it doesn't have any javac file with it..
javac -classpath c:\apache-tomcat-6.0.16\lib\servlet-api.jar;C:\apache-tomcat-6.0.16\webapps\rmanew\WEB-INF\classes VendServlet.java


Hope, you understand my problem now....
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19696
    
  20

This is a PATH / CLASSPATH problem so moving to beginner.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Originally posted by Rob Prime:
This is a PATH / CLASSPATH problem so moving to beginner.


How this was an PATH / CLASSPATH problem,,,, Would you please explain it to me.... Please i need you help, ranchers...
Shiva Kumar Shedad
Greenhorn

Joined: Jun 11, 2007
Posts: 10
Dude, first understand how an operating system looks for an exe to execute.
In case of Windows it looks into PATH environment variable to get the path of the exe and execute it.

The error you are getting tells that your OS is not able to find the javac.exe to execute.

So add your jdk/bin to your PATH variable and then try to execute the same command.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38873
    
  23
If you are getting a "javac is not recognised . . ." error then you're on Windows and you haven't set your PATH properly. There are instructions for Windows on this Java Tutorial page; look for where it says about not recognized. It tells you how to sort that out, but when you follow the links it says "optional." In that case o-p-t-i-o-n-a-l is pronounced "absolutely definitely compulsory."

And you don't have to set the CLASSPATH as an environment variable.
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Thanks for all your time... I do some resarch and will be back soon...
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14153
    
  18

Note that PATH and CLASSPATH are two completely different things.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: POI File Not Compiling Problem