This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan 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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 1456
    
    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: 3156
    
  10
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
Problems compiling packages #2 with JSP
Basic doubt in compiling servlets
running a servlet without IDE
Invalid Flag Error when using javac