• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem in compiling servlet

 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you read our Servlets Faq? And this Compiling Servlets FAQ?
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Beware the other head of science - it bites! Nibble on this message:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic