File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Unable to find a javac compiler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Unable to find a javac compiler" Watch "Unable to find a javac compiler" New topic

Unable to find a javac compiler

Michael Talavera

Joined: Jul 26, 2004
Posts: 5
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; 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

Joined: Feb 20, 2001
Posts: 3695

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

Joined: Jul 26, 2004
Posts: 5
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.
I agree. Here's the link:
subject: Unable to find a javac compiler
It's not a secret anymore!