File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes cant compile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "cant compile" Watch "cant compile" New topic

cant compile

sherrie blaylock

Joined: Nov 17, 2004
Posts: 3
javac -classpath /your path/tomcat/common/lib/ servlet-api-jar -d classes src/

this command is supposed to compile a java file and place the create class file in the src path but it is not there
trying to learn the headfirst servlets & jsp book and am stuck very early on with this not working

also, i dont know how to set the environment variables or if they are right
please ehlp
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529


I assume you are replacing "your path" with the actual path to tomcat, right?

the "-d classes" in your command actually puts the class file in the classes directory, not the src directory.

In DOS, you can set the CLASSPATH environment variable with the SET command:

C:\> set CLASSPATH=.;c:/project1/src;c:/tomcat/common/lib/servlet-api.jar;

If you want this to be in effect everytime you open a DOS command window, you would right click on "My Computer", select "Properties", click on the Advanced tab, then click on the Environment Variables button. Then add the CLASSPATH to the System Variables.
[ November 17, 2004: Message edited by: Junilu Lacar ]

Junilu - [How to Ask Questions] [How to Answer Questions]
I agree. Here's the link:
subject: cant compile
It's not a secret anymore!