• 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

Compiling servlet : error no source files

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm reading Head first Servlets and JSP 2nd Edition and I have a problem when I try to compile my servlet class.

Here is my files (I'm actually on the beerV1 folder) :
.
└── beerV1
   ├── classes
   │   └── com
   │       └── example
   │           ├── model
   │           │   └── BeerExpert.class
   │           └── web
   │               └── BeerSelect.class
   ├── etc
   │   └── web.xml
   ├── lib
   ├── src
   │   └── com
   │       └── example
   │           ├── model
   │           │   └── BeerExpert.java
   │           └── web
   │               └── BeerSelect.java
   └── web
       └── form.html

What I have to do :

I'm following these instructions from the book :

cd beerV1
javac -classpath /Users/bert/Applications2/tomcat/common/lib/
servlet-api.jar:classes:. -d classes src/com/example/web/BeerSelect.java



What I've done :

Since I'm on windows, I replaced ":" with ";".
So I did this :

javac -classpath /mnt/c/apache-tomcat-9.0.20/lib/servlet-api.jar;classes;. -d classes src/com/example/web/BeerSelect.java



But the output I get is this :

error: no source files
classes: command not found
-bash: .: -d: invalid option
.: usage: . filename [arguments]



I don't understand this problem because I did exactly what I was asked to do in the book.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you try it again with the classpath in quotes?

javac -classpath "/mnt/c/apache-tomcat-9.0.20/lib/servlet-api.jar;classes;". -d classes src/com/example/web/BeerSelect.java

Also, is this a valid path in Windows? On my machine the path looks more like c:/apache....
 
Dave Jovi
Greenhorn
Posts: 7
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:Can you try it again with the classpath in quotes?

javac -classpath "/mnt/c/apache-tomcat-9.0.20/lib/servlet-api.jar;classes;". -d classes src/com/example/web/BeerSelect.java

Also, is this a valid path in Windows? On my machine the path looks more like c:/apache....



Thank you for pointing that it solves my problem... That was my fault I've completely misunderstood when the book said that whe should replace ":" if we are using windows OS. I'm typing on the linux console on windows, so there is no replacement to do.

Everything works perfectly now thank you again.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah. So you are using Linux. That makes sense!
 
We're all out of roofs. But we still have tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic