• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to find a javac compiler

 
Michael Talavera
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just installed Tomcat 5.0.27 and java SDK 1.4.2_05 and am having a problem with the service. I have a Windows XP machine and the service will start, but when I try and run the application, I get the following errors:

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

The curious part is that when I shut down the service and just run the startup.bat file found in the Tomcat bin directory, everything works just fine.

The SKD is installed at C:\j2sdk1.4.2_05, which I have set as JAVA_HOME. I have also included this directory in the path, classpath, along with the bin directory. I've tried to analyze the service.bat file thinking maybe the problem lies there, but am not having any luck finding the issue. Is there a fundamental difference between the way Tomcat starts with the service compared to the bat file? Please help.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a fundamental difference. At the risk of sounding snippy... one is a process you launch from a batch file, and one is launched by your OS at startup, through settings in the Registry (where all Services are launched from).

So for example, if you had installed (or configured JAVA_HOME) after you installed Tomcat, the service will fail, but the batch file will not.

Just for the heck of it, uninstall and re-install Tomcat, and as you're clicking 'Next', make sure its finding everything (the tomcat installer has been known to point to a JRE, rather than a JDK, for example).
 
Michael Talavera
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have solved the problem, though I don't know why I had to do this since I never needed to before. I located the tools.jar file and moved it to the CATALINA_HOME/common/lib directory. This allows the application to run and the service to start up correctly. Maybe this is because Tomcat can't located the actual java sdk I have installed, but I am at least able to run the application again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic