Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Unable to complie

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to Servlets and JSPs.I am reading HF Servlets and JSP book so I have written my first servlet as code is given in HF on page no 30 and 31 and I have followed all steps(folder making etc).

I have made my project folder in F drive path is : F:\project1

my tomcat folder path is C:\Program Files\Apache Software Foundation\Tomcat 4.1

Now in book it is written that I need to use this command

%javac -classpath /your path/tomcat/common/lib/servlet-api.jar -d classes src/Ch1Servlet.java

So I m using

javac -classpath C:/Program Files/Apache Software Foundation/Tomcat 4.1/common/lib/servlet-api.jar -d classes src/Ch1Servlet.java

It is saying:

javac: invalid flag: Files/Apache
Usage: javac <options> <source files>
use -help for a list of possible options

but on my comp i can compile any java file.
one more thing I don't have this file(servlet-api.jar) in my lib folder of tomcat.

Please suggest a solution.
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the classpath contains spaces it needs to be surrounded by quotes:


That servlet-api.jar is not in common/lib sounds like a problem - which libraries do you have in that directory?
[ May 27, 2007: Message edited by: Ulf Dittmer ]
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem is with the spaces in the path mentioned with the classpath switch.
pl. set CLASSPATH variable by using "<path>"
ex. -classpath "C:/Program Files/Apache Software Foundation/Tomcat 4.1/common/lib/servlet-api.jar"

This is the problem with your command line.
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Spaces indeed are a problem.
Servet-api.jar should have been present by default.
What happened to that were you able to fix it ?

-Cheers
 
hemant chaudhary
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry for late reply.

after including quotes i was getting 5 errors:

One of them:
-------------------------------------------------------------------
F:\project1>javac -classpath "C:/Program Files/Apache Software Foundation/Tomcat
4.1/common/lib/servlet-api.jar" -d classes src/Ch1Servlet.java
src\Ch1Servlet.java:1: package javax.servlet does not exist
import javax.servlet.*;
^

-----------------------------------------------------------------------

Then I changed sevlet-api.jar to servlet.jar(this one is ther ein lib directory) and now it is working

Thanks to all you people for replying.

~Hemant
 
You can't expect to wield supreme executive power just because
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic