• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compilation problem in Windows Command Prompt

 
thomas jacob
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added the classpath to the user variables. I tried running the command on Windows 2000 command prompt
javac -classpath C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar -d classes src\Ch1Servlet.java

The command prompt does seem to recognize the spaces between the filename. Even adding the classpath to the environment variable does not work.

Anyway I found a work around by copying the servlet-api.jar on root C: drive and then modify the command to generate the java classes

javac -classpath C:\servlet-api.jar -d classes src\Ch1Servlet.java

This does compiles and generates the classes, but I am curious if anybody had this problem in Windows 2000 and solved it the conventional way. Please suggest a solution, I am bit restless to make it workconventionally.

Regards
Jacob
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should add double-quotations :
-classpath "C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar"
 
thomas jacob
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried adding the double quotes but it does not find the servlet-api.jar from that location. Bottomline: Double Quotes in the path does not work.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I love your bottomline
But double quotations do work.
Check your path again.
For example :
dir C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar

If it still doesn't work, try to add it to your environment:
1. Right-Click My Computer, Properties
2. Details/Environment variable
3. look for CLASSPATH (or create it) and add the full path to your JAR file
4. Click OK and restart a new command prompt
 
Ramya Iyer
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Hope you invoke the command prompt using cmd and not command. Open up using cmd and use double quotes.

Regards,
Ramya.
 
thomas jacob
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks the real problem was I didn't have the classes folder to output the classes file in place. But the command prompt error I got for that was absurd. I got import statement errors related to servlet-api.jar.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic