• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error while compling

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the reply!....Since I am a beginner please forgive my ignorance!.....
 
Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic