Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error while compling

 
Sandy Marar
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What could be the reason of the error when tried to run the following command in the command line

d:\Project1>javac -classpath D:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\servlet-api.jar -d classes src\Ch1Servlet.java

javac: invalid flag: Files/Apache
Usage: javac <options> <source files>
use -help for a list of possible options
 
Anayonkar Shivalkar
Bartender
Posts: 1557
5
Eclipse IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error message itself is self-explanatory:

invalid flag: Files/Apache

This is due to space between 'Program' and 'Files'. Try putting your classpath in quotest.

Also, there's a dedicated forum for Servlets where you can get better help about servlet issues (this issue is not related to servlet thought)
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandy Marar wrote:What could be the reason of the error when tried to run the following command in the command line

d:\Project1>javac -classpath D://Program Files/Apache Software Foundation/Tomcat
7.0/lib/servlet-api.jar -d classes src/Ch1Servlet.java

javac: invalid flag: Files/Apache
Usage: javac <options> <source files>
use -help for a list of possible options

The directory name has spaces in it. Enclose it in double quotes and it should work.
javac -classpath "D://Program Files/Apache Software Foundation/Tomcat 7.0/lib/servlet-api.jar" -d classes src/Ch1Servlet.java
 
Sandy Marar
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply!....Since I am a beginner please forgive my ignorance!.....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic