Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

POI File Not Compiling Problem

 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20533
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a PATH / CLASSPATH problem so moving to beginner.
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 48981
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all your time... I do some resarch and will be back soon...
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15288
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that PATH and CLASSPATH are two completely different things.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic