Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in compiling servlet

 
Brij Garg
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have java installed in system directory that is C:\j2sdk1.4.2_05\

tomcat is also in C:\Tomcat 5.0

I am not able to compile servlet test1.java from command prompt.

command and the message i am getting is given below.


C:\j2sdk1.4.2_05\bin>javac -classpath C:/Tomcat 5.0/common/lib/servlet-api.jar test1.java
javac: invalid flag: 5.0/common/lib/servlet-api.jar
Usage: javac <options> <source files>

can someone help ?
thanks
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't have a space, try adding quotes:

javac -classpath "C:/Tomcat 5.0/common/lib/servlet-api.jar" test1.java
 
Campbell Ritchie
Sheriff
Pie
Posts: 49442
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read our Servlets Faq? And this Compiling Servlets FAQ?
 
benjamin muktesh
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apart from what is already suggested, I would strongly recommend setting up the classpath and path variables. That way you wont have to provide the full path to your java file everytime you want to compile.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49442
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by benjamin muktesh:
Apart from what is already suggested, I would strongly recommend setting up the classpath and path variables. That way you wont have to provide the full path to your java file everytime you want to compile.
Not usually a good idea to set a classpath permanently. The original poster's path must already be set, otherwise we would be looking at a load of different error messages.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic