• 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

javac doesn't see the servlet.jar file

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've searched through the ranch archives and the last posts related to this topic are dated in the year 2000 and haven't really answered my question.

I'm reading the Core Servlets book and trying to follow along setting up the classpath of all things. This should be simple, however, I'm not quite getting this development environment setup correctly.

I have the j2sdk 1.4.1.01 downloaded and installed here:
C:\j2sdk1.4.1_01

I have Tomcat 4.1 downloaded and installed here:
C:\Tomcat 4.1 (notice the space)

I have a servlet development directory here:
C:\ServletDev

My CLASSPATH environmental variable looks like this:
.;C:\ServletDevl;"C:\Tomcat 4.1\common\lib\servlet.jar"

My JAVA_HOME environmental varialbe looks like this:
C:\j2sdk1.4.1_01

My Path environmental variable looks like this:
.;C:\j2sdk1.4.1_01\bin; ...etc

I know I should have quotes around the path string in the CLASSPATH variable, but do they go around the whole path or just around the Tomcat 4.1 part?

The text has an example CLASSPATH variable that looks like this:
.;C:\ServletDev;install_dir\common\lib\servlet.jar

I've also read that I can copy the servlet.jar file to somewhere in the j2sdk, but I don't want to unless I have to.

I can open DOS and type from any directory and type:

java -version
javac -help

with no problems. I just can't compile a java source file that extends HttpServlet from any directory. I'm not going to use an IDE unless I have to.

I can also place a jsp file in the ROOT directory of Tomcat which contains a scriptlet <%= new java.util.Date() %> wrapped in html and get a result with no problems.

Any suggestions, or is anyone seeing something I'm forgeting?

Thanks everyone.
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


have a servlet development directory here:
C:\ServletDev

My CLASSPATH environmental variable looks like this:
.;C:\ServletDevl;"C:\Tomcat 4.1\common\lib\servlet.jar"



Hi Leo,

I think you have misspelled your directory in the classpath, it should be ServletDev instead of ServletDevl.
 
leo donahue
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are correct! I did misspell that!

I made the change and I am still unable to compile a java file that extends HttpServlet.

My command line message says:

package javax.servlet does not exist.

I would expect this since my classpath variable is wrong somehow, but I don't see what else it could be.

Thank you,
 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by leo donahue:
You are correct! I did misspell that!

I made the change and I am still unable to compile a java file that extends HttpServlet.



Check your JAVA_HOME AND CATELINA_HOME , are pointing to correct location
[ October 04, 2004: Message edited by: Santosh Maskar ]
 
leo donahue
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks everyone, I have it now.

I forgot to add the CATALINA_HOME variable and then uncommented the path string to the servlet.jar in the CLASSPATH variable. I turned on servlet-mapping in the web.xml, stopped the server and restarted it and everything is working.

Thanks again.
 
reply
    Bookmark Topic Watch Topic
  • New Topic