Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javac not working in my deployment folders 1

Status
Not open for further replies.

evergreean

Technical User
Feb 15, 2006
68
US
I have Tomcat 5.5 Container set up on my Windows XP.

The only issue I have is I can only compile my Java classes in the jdk1.5.0_06\bin directory.

How can I set it up so I can compile the java classes in any of my deployment folders. For instance I want to create the classes using my DOS window command prompt located in: C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\jsp-examples\WEB-INF\classes\num it says:
'javac' is not recognized as an internal or external command,
operable program or batch file.

Please advise how or what I need to set up the javac compiler to work in any of my deployment folders?
 
This is a simple OS PATH issue - and is discussed in detail on Sun's "getting started with java" site :
If you cannot even compile a programme, I would really take a step back and learn Java 101 before playing with a J2EE technology.

Still, I doubt you'll take my advice, people are so impatient these days (apologies if you are patient !) ... so :

Lets assume you have java installed here : C:/jdk_1.5

Add environment variables to your OS :

set JAVA_HOME=C:\jdk_1.5
set PATH=%PATH%;%JAVA_HOME%\bin

You will then be able to invoke the javac.exe and java.exe programmes from the command line.

BTW, its bad form to compile your classes in the actual TOMCAT_HOME/webapps directory. You really should look into creating a jar file with your compiled code, and then deploying that into JAVA_HOME/webapps/yourWebappName/WEB-INF/lib , or even better creating a war file (proabbly using ant, or even just the jar.exe tool), and deploying that.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top