This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I've only just passed my SCJP6 and now trying to study for SCWCD, Im currenlty working through the HeadFirst book Servlets & JSP, but and a big but, I have followed the instructions on installing Tomcat and have done with no problems I can start Tomcat and view HTML pages no problem but when I try and compile a servlet I'm getting the message saying 'javac' is not recognized as an internal or external.........(you know the rest)
The page I'm stuck on is pg 81 Compiling, deploying, and testing the controller servlet (if anyone has this book)
The page displays the following:-
javac -classpath /Users/bert/Applications/tomcat/common/lib/servlet-api.jar:classes:. -d classes src/com/example/web/BeerSelect.java
Please can some one give me some pointers, I'm loosing the will to live and slowing dieing inside.
Not only "what did you use as your PATH?" but also "what did you use as a CLASSPATH?" You can do no end of harm by setting a system CLASSPATH. Don't. If there is nothing in the system CLASSPATH which you haven't set yourself, delete it altogether. If there is anything in the system CLASSPATH which you didn't set yourself, add .; (on Windows) to the beginning of the CLASSPATH string.
Joined: Oct 14, 2010
Cheers for the Welcome,
In the cmd I entered the following:-
set PATH=c:\Program Files\Java\jdk1.6.0_18\bin;%PATH%
also in the System Variable I enter this as my CLASSPATH:-
C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar
This I know is wrong but still unsure what to do.
I can say now I passed my SCJP but fundamentals section was my lowest area.
Joined: Oct 13, 2005
Delete that system classpath. Your PATH looks probably correct, assuming you installed Java™ in its default location. Since it has spaces in, you might need to enclose the PATH variable in "" quotes.
Try compiling with the -cp tag. You can find details of the tag for the "java" tool and for the "javac" tool on the net. I think you would have to use -cp .;C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar but I am not certain.
When you deploy your files as a .jar you would include those .jars in the classpath in the manifest file.