• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Problems with compiling Servlet version two code in HFSJ

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am having problems with compiling Servlet version two code in HFSJ(page-85)
I have kept model class at-> D:\MyProjects\beerV1\src\com\example\model\BeerExpert.java

Servlet at-> D:\MyProjects\beerV1\src\com\example\web\BeerSelect.java

servlet-api at->C:\Tomcat\apache-tomcat-5.5.23\common\lib\servlet-api.jar
Now I am trying to compile using:
javac -classpath "C:\Tomcat\apache-tomcat-5.5.23\common\lib\servlet-api.jar;". -d classes -sourcepath src/com/examples/web/BeerSelect.java

It is not getting compiled giving the following error:

javac: no source files
Usage: javac <options> <source files>
use -help for a list of possible options

This problem was being faced by marten(https://coderanch.com/t/407370/java/java/Problems-compiling-packages-JSP) & he got it resolved,but unfortunately I am still stuck with it
Please help me.

~ Veeru
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never used -sourcepath, but I think that it takes a directory as parameter, not a file name. So instead of

... -sourcepath src/com/examples/web/BeerSelect.java

try:

... -sourcepath src/com/examples/web BeerSelect.java

or leave it out completely and just specify the file name:

... src/com/examples/web/BeerSelect.java
 
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Veeru,


Nice to see that are still people which are compile from the command like (like in the good old times ) - your problem is the "-sourcepath src/com/examples/web/BeerSelect.java", you must specify the file to compile so remove the sourcepath and provde only the file to compile.

My advice is to use a IDE to compile or if you are a command line freak you can use a ant script to make your like easy.

Regards,
M
 
Veeru Bond
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks!
I tried with both
-sourcepath src/com/examples/web BeerSelect.java
as well as by removing the sourcepath altogether
src/com/examples/web/BeerSelect.java
But still facing the same error
Please help.

~ Veeru
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic