Hi all, I just downloaded Tomcat 4.0 on my windows NT machine and I have installed the same.I can get to the tomcat homepage localhost:8080 without any problems. My problem comes when I am trying to compile servlets under tomcat4.0. For some reason it is not including the servlet.jar files in the classpath. I have set CATALINA_HOME and JAVA_HOME ( I previously had set TOMCAT_HOME FOR tomcat3.2.3..tried removing and adding and changing that and I doesnt work ). IN tomcat 3.2.3 u could go to the bin directory and say tomcat env and it would add the relevant classfiles to the classpath. IN 4.0 though a similar batch file exists called catalina, it does not seem to add all the relevant jars to the classpath and hence I am unable to compile under 4.0. When I cay catalina env in the bin directory I get the following statements Using CATALINA_BASE: c:\tomcat Using CATALINA_HOME: c:\tomcat Using CLASSPATH: c:\tomcat\bin\bootstrap.jar;c:\jdk1.3.1\lib\tools.jar Using JAVA_HOME: c:\jdk1.3.1 obviously its is not adding the servlet.jar and other relevant jars hence my problem. Am I missing something obvious here? I also tried manually adding the classpath of the servlet.jar to the classpath variable and even that didnt work.Can someone help me here? Thanks Sagar
I heartily recommend the ANT build environment for controlling these annoying classpath problems. ANT is sort of a super MAKE facility. You can download it from jakarta.apache.org After an hour or so you will wonder how you ever got along without it. Bill
Hi Sagar, i copied my servlet.jar file to the c:\jdk1.4\lib folder in my win2000 machine and m compiling in jdk-bin folder. Also try so set the classpath in the command propmt each time u start the dos window.... Rather i m facing a problem in my house where Tomcat 4 is running excellently in win2000 but telling to set JAVA_HOME win98... ...but i did set everything in autoexec.bat file. Then i also set them in command prompt and checked that dos is using 4096kb memory. In dos propmt when i echo my java_home it shows my jdk installation folder but when i run tomcat it says to set JAVA_HOME. I m also using JSDK2.1 but in different port 6060.... Sagar, lemme know whether the trick worked and also plz any help to my problem....
------------------ Muhammad Ashikuzzaman (Fahim) Sun Certified Programmer for the Java� 2 Platform --When you learn something, learn it by heart!
Ashik Uzzaman Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
Joined: Apr 26, 2001
Hi Mike, Thanks for ur advice.,I am using a DOS window for compilation and yeah I added the classpath in the javac command and it worked. Should I manually add each jar to the classpath? Also if I say classpath=c:\conf\lib\ will it pick up all the jars from the lib directory or should I say classpath=c:\conf\lib\*.jar ( I dont think the * would work ) Ashik, u might wanna try giving it the classpath of tools.jar and rt.jar when u compile ur programs.. Thanks Sagar
Hello, All. I having the same problems. SET CLASSPATH=C:\PROGRAM FILES\APACHE TOMCAT 4.0\COMMON\LIB\SERVLET.JAR I set my class path just like this and it's not seeing the jar file when I attempt to compile my servlet program. I can set the class path as mentioned in several of the other responses and it compiles, however, that's the only way I've gotten it to work. Another thing is I'm not that clear on how class paths work and how they should be set up in the autoexec.bat file. Would anyone know of a resource that can explain it throughly? Also, how do you set up JAVA_HOME and TOMCAT_HOME. I guess what I'm looking for is the correct syntax and where. thanks,
------------------ Donald Nunn Sun Certified Programmer for the Java� 2 Platform
<b>Donald Nunn</b><br />Sun Certified Programmer for the Java 2 Platform
Joined: Apr 26, 2001
Hi all, Thanks for everyones reply to this post. I tried copying the jar files to the ext directory and it works like a charm. I dont know what you mean when u say u dont understand how to set JAVA_HOME and TOMCAT_HOME.. all u need to do is add the follwing lines in your autoexec.bat file. set JAVA_HOME=c:\jdk1.3.1 (wherever ur jdk resides) set TOMCAT_HOME=c:\jakarta-tomcat-3.2.3 ( wherever ur tomcat is installed) the reason we need to set it is so that the batch files which are provided with tomcat can run properly as they rely on these values to set up everything correctly. Also as I mentioned earlier if u have tomcat3.2.3 all u need to do is open a dos window go to the bin directory and say tomcat env. It will add all the relevant jars to the classpath. donald, u might want to lok at these links to get an idea of how classpaths work. http://java.sun.com/products/jdk/1.2/docs/tooldocs/win32/classpath.html http://www.weblogic.com/docs51/admindocs/classpath.html#whatis
Joined: Nov 11, 2000
Thanks, Sagar. You answered all of my questions. I just needed to see the syntax for JAVA_HOME and TOMCAT_HOME. Thanks, a lot. ------------------ Donald Nunn Sun Certified Programmer for the Java� 2 Platform
Don't overlook what William said about Ant, though. It's a lot better than batch or makefiles. Ant build files are simple, handle dependent build steps, and are OS-independent. Windows environment variables (such as CLASSPATH, JAVA_HOME, and the tomcat variables) aren't even handled consistently between the DOS-based Windows (9x) and the NT-based Windows environments (NT, Win2K, and - I presume - XP).
Customer surveys are for companies who didn't pay proper attention to begin with.