I am a beginner with java and new with this forum so be patient with me
I am using Mac OS X version 10.5.5 and i have installed Tomcat version 6.0.18 I have set up: CATALINA_HOME /Library/Tomcat/Home JAVA_HOME /Library/Tomcat/Home CLASSPATH /Library/Java/Home/lib/servlet-api.jar;/Library/Java/Home/lib/jsp-api.jar
When i start tomcat i can bring up the tomcat home page (http://localhost:8080) with no problem. But when i try to compile a servlet through my terminal i get the "javax.servlet does not exist" and "javax.servlet.http does not exist" errors.
I have read on the internet and this forum that it is my CLASSPATH that is the culprit but i am unsure what my error is.
If anyone can help me i would greatly appreciate it
Your setting for JAVA_HOME is wrong. It's not the Tomcat root.
And did you copy servlet-api.jar and jsp-api.jar to /Library/Java/Home? If so, that's a poor idea. You should just reference them in-place in the Tomcat distribution. That way you are sure that the jar you are compiling against is the same as the one you are running against. [ October 22, 2008: Message edited by: Bear Bibeault ]
hi I have got exactly same problem and its been 2 days I am trying to sort it out but it doesnt seem to work. I dont know what is classpath variable.. is it the same as PATH variable in environment variables? I have already set it to point to ....\tomcat 6.0\lib\servlet-api.jar but its still not working is there anything i m missing or that i dont know. Please let me know I would really appreciate your help
If you are using an IDE like Eclipse or NetBeans you can just right click on the project and configure your class path by adding the appropriate libraries.
If you are still using cmd and notepad, open your cmd and type java(assuming your java.exe is in the system path). It gives you a lot many options and 2 of them are for adding libraries to your classpath. (-cp and -classpath)
this one didnt work so i searched on internet and i have created a new variable CLASSPATH in environment variables and added this path there but it still doesnt work... i will check the FAQs now but if you have any other sugession please leme know.
so i searched on internet and i have created a new variable CLASSPATH in environment variables and added this path there but it still doesnt work
How did you tried it? Fired up a new command prompt? Because It's necessary for changes to take effect. By the way what command did you use there? javac nameofthefile.java ? [ October 23, 2008: Message edited by: Vijitha Kumara ]
Don't add anything to your CLASSPATH environment variables; add them at the command-line. You will probably find details of the java and javac tools here, and you can find the classpath options from their webpages.
posted 10 years ago
i have restarted the cmd prompt i have even restarted my computer here is what i get when i type command
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ebookshop\WEB-INF \src\ebookshop>javac -cp c:\Program Files\Apache Software Foundation\Tomcat 6.0\ lib\servlet-api.jar ShoppingServlet.java javac: invalid flag: Files\Apache Usage: javac <options> <source files> use -help for a list of possible options
OK GUYS THANKS VERY MUCH I HAVE MANAGED TO FIX IT I JUST HAD TO PUT IT IN QUOTES
[ October 23, 2008: Message edited by: roomy iqbal ] [ October 23, 2008: Message edited by: roomy iqbal ]