This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hai everybody, I am new to javaservlets . I have java in c:/jdk1.4.1_02 my class path variables are: CLASSPATH:c:\j2sdk1.4.1_02\bin\; JAVA_HOME:c:\j2sdk1.4.1_02\bin Path:c:\j2sdk1.4.1_02\bin\; now I downloaded jswdk-1.0.1 for servlets it was in C:\jsdksevlet\jswdk-1.0.1 I started tomcat server when I tried to compile HelloWorld.java on the server it is giving error so how to fix it? I included in CLASSPATH:C:\jsdksevlet\jswdk-1.0.1\lib ONE MORE THINK IS I HAVE J2SE IN C DIRECTORY. PLEASE CLARIFY I AM IN CONFUSION THANK YOU VERY MUCH HELP WILL BE APPRECIATED [ October 13, 2003: Message edited by: Mike Curwen ]
this might not solve all your problems but JAVA_HOME should point to your java directory NOT the java/bin directory. PATH should point to the bin directory. CLASSPATH should include the java/lib directory. also tomcat needs CATALINA_HOME to point to where you installed tomcat. im not sure what all that jswdk-1.0.1 is you have and im not sure if you need it, ill let someone else deal with that.
Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
I've just read your post closer. It seems you have tomcat already? Then just uninstall that JSWDK and removing all traces of it from classpath, path, java_home, etc, etc.
Everything you need to compile and run servlets is included with the Tomcat download.
as Tim mentioned, JAVA_HOME should be c:\jdk1.4.1_02 CATALINA_HOME should be c:\tomcat4.1.27 (or similar)
You can ignore CLASSPATH, as Tomcat does NOT use system classpath.
But to compile your servlets, you'll need to ensure that servlet.jar is on the classpath. I'd recommend getting cozy with ANT, or use the command-line -classpath switch over system CLASSPATH. servlet.jar is included with the Tomcat distribution.
Joined: Oct 13, 2003
I really appreciate your help.Thanks you very much. one more thing, just now I am reading a book, it says JSDK files has to be in my classpath ,to run servlet, so what I have to do?
First it was jswdk, now it's jsdk. Which one? The reason I'm being particular is that almost any combination of letters that starts with 'j' has at one time been provided as a download/api/package by Sun.
JSWDK: JavaServer Web Development Kit JSDK : Java Servlet Development Kit *Neither* of which is the latest. And I'm not talking just a few months or even a year. You'd have to find these downloads in the archive section of Sun's web site.
What you *need* to do is stop reading that book. If it talks about the newest technology, but makes mistakes like referring to it as a jsdk, then it's not a good book. If it's not making a mistake, then the book is *very* out of date.
If it's the only book you got, then we'll try to make the best of it.
As for classpath... please do NOT concern yourself with classpath if you are using Tomcat. Tomcat does NOT use the system CLASSPATH variable. Simply installing Tomcat and setting CATALINA_HOME variable is all you need. This is explained in the Tomcat installation documents.
The only time you worry about classpath is when you are *compiling* servlets. And this is more appropriately handled by sending the path to servlet.jar (the jar file that contains all the servlet API classes) as a command-line switch to javac.
Another suggestion ... If you don't want to spend the time learning Ant(recommended) and you don't want to have to keep typing out this long command line just to compile servlet(s) i.e. and believe me, you will be doing this alot. I would recommend creating and storing this information in a CLASSPATH environment variable for example This particular line of code uses the j2ee.jar file from the enterprise edition which includes the servlet api and among others. Which you can also download form Sun's website. Or you can just use the servlet.jar file from tomcat, for example
Also one more thing don't forget the period, it says include your PWD(present working directory) as apart of your classpath. Now all you have to do at the command line is
But choose the way that is more efficient for you.
Joined: Oct 13, 2003
thank you very much . I really appreciate u r help.