File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 1506
    
    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: 3542
    
  15
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