• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Error compiling my first servlet

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings:

I have just installed Tomcat 5.5 on my Windows XP notebook and I am trying to compile my first servlet -- the beerApp in HFSJ. The Java compiler complains that it can't find the javax.servlet.* and javax.servlet.http packages.

I found the FAQ on JavaRanch about setting CLASSPATH to TOMCAT_INSTALL_DIRECTORY/common/lib/servlet-api.jar, which in my case is ...

C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\Program Files\Java\jdk1.5.0_07\bin;c:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar

A few things:

- I still get the same compiler error - even after rebooting

- When I enter the PATH command in the DOS shell, it does not show the same CLASSPATH setting I made in Control Panel -> System -> Environmental Variables. Are PATH and CLASSPATH the same? DOS doesn't seem to recognize CLASSPATH

- Does my CLASSPATH look at least plausable?

c:\Program Files\Java\jdk1.5.0_07\bin;c:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar

Thanks, -Brad
 
Rancher
Posts: 5035
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Somewhere on this site there is a nice description of how to install JDK and the PATH and CLASSPATH. path and classpath are for different purposes. path is for the OS to find commands, classpath is for the jvm to find classes.
Your classpath looks reasonable.
 
Marshal
Posts: 79969
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at this FAQ page.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Remove c:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar from the PATH, it doesn't belong there.

Also, remove c:\Program Files\Java\jdk1.5.0_07\bin; from the CLASSPATH.

PATH and CLASSPATH are two different things. PATH is used by the operating system to find executable files. CLASSPATH is for Java only, and is used to find Java classes. To see what either of those environment variables is set to, type:

set PATH

or

set CLASSPATH

in the Windows command prompt window.
[ August 30, 2008: Message edited by: Jesper Young ]
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic