• 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

Classpath problem with Tomcat

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I was trying to workout the MVC example in HF S&J chapter 3, I get an error with Tomcat saying that the root cause:

Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK

and my path sttings are:
JAVA_HOME:c:\j2sdk1.4.2_06
PATH:%JAVA_HOME%\bin
CLASSPATH:C:\j2sdkee1.3\lib\j2ee.jar;%JAVA_HOME%\bin;
c:\prj\coffee-v1\classes;c:\tomcat\common\lib\servlet-api.jar;

and am working on windows!
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
are you starting tomcat from a windows service? (tomcat runs when you turn on your computer)...

If so, it does not use the JAVA_HOME variable you've set. You have to manually tweak the registry.
 
J Chitra
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mike!
I am running Tomcat manually. I find the SCWCD forum more appropriate for this and found questions of same sort and i have posted the same topic there.
Thanks again.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what version of windows, what version of Tomcat?

What do you get when you type:

cd c:\j2sdk1.4.2_06\bin
java -version

finally, though I'm against the advice (because you should be able to get Tomcat working without this).. you could copy tools.jar from your JDK into the common/lib directory of Tomcat. This is noted in the second bullet point on this page
 
J Chitra
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Mike,
Many thanks.
windows:XP,Tomcat:5.0.28
I checked the version of java and it is:
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)

I copied the tool.jar to common\lib in tomcat, it works fine now.

by the way, may i know why r u against this?
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For the same reason I'm against putting anything in the /ext directory. It should be possible to keep tools.jar in *one* place, and have it referenced. That's what JAVA_HOME is supposed to do. As an example of why this is bad: Let's say 8 months from now, you upgrade your JDK. Let's say that there are incompatibilities. Are you going to remember that 8 months ago, you copied tools.jar into common/lib?
 
J Chitra
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gotcha!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic