This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes  Error while compling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark " Error while compling" Watch " Error while compling" New topic
Author

Error while compling

Sandy Marar
Greenhorn

Joined: Dec 22, 2011
Posts: 16
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

Joined: Dec 08, 2010
Posts: 1502
    
    5

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)


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3419
    
  12
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

Joanne
Sandy Marar
Greenhorn

Joined: Dec 22, 2011
Posts: 16
Thank you for the reply!....Since I am a beginner please forgive my ignorance!.....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error while compling
 
Similar Threads
Classpath in Command line
Invalid Flag Error when using javac
Basic doubt in compiling servlets
Problems compiling packages #2 with JSP
running a servlet without IDE