unable to find a javac compiler


New to IDEA. Using version 3.0.5. with Tomcat 4.1. When I test my first JSP I always get the error below. Can't figure out how to solve this. Already created and ran servlet with success. Can somebody help me?


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
at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:139)
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:835)



Did you solve this problem?
I am getting it too now.

Stephen Chalkley


I'm getting this, also.

I'm running IDEA 4.0.3 on Windows XP with J2SE 1.4.2_03, and trying to use a custom run setting with the included Tomcat plug-in seemingly properly configured, to run Tomcat 4.1.27.

The output seems to clearly indicate that Tomcat is being started with the proper location of tools.jar in the classpath, yet the result of attempting to view a JSP page is as follows.

+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+

tools.jar does not seem to be corrupt as starting Tomcat outside IDEA works fine. tools.jar does contain com.sun.tools.javac.Main

The JAVA_HOME variable is properly specified in my OS.

Starting Tomcat outside IDEA works fine.

For reference, the command used by IDEA to start Tomcat follows.

K:/java/j2sdk1.4.2_03\bin\java -Djava.endorsed.dirs=K:\java\tomcat\tomcat-4.1.27\bin;K:\java\tomcat\tomcat-4.1.27\common\lib -Dcatalina.base=K:\java\IDEs\IDEA\IntelliJ-IDEA-4.0.3\system\tomcat_admin_f5ffd0ae -Dcatalina.home=K:\java\tomcat\tomcat-4.1.27 -Djava.io.tmpdir=K:\java\tomcat\tomcat-4.1.27\temp -Dfile.encoding=windows-1252 -classpath K:\java\j2sdk1.4.2_03\lib\tools.jar;K:\java\tomcat\tomcat-4.1.27\bin\bootstrap.jar;K:\java\IDEs\IDEA\IntelliJ-IDEA-4.0.3\lib\idea_rt.jar -Didea.launcher.port=7539 -Didea.launcher.library=K:\java\IDEs\IDEA\IntelliJ-IDEA-4.0.3\bin\breakgen.dll com.intellij.rt.execution.application.AppMain org.apache.catalina.startup.Bootstrap start

It serves html files fine.

Does anybody have any ideas on getting this to work?


I just tried it out with Tomcat 5.0.19 and things seem to work fine. It uses the same classpath setting, except where the location of Tomcat JARs is concerned.

But, I'm still looking to get this to work with Tomcat 4.1.27.


IDEA 4 does NOT support tomcat 4.1, only tomcat 4.0 is supported. I know it's an idiot thing, but it's this way.


Got it working with 4.0.6.



For what it's worth, I believe I've tracked down the problem.

Tomcat 4.0.x and Tomcat 4.1.x seem to need a different value for the java.endorsed.dirs value.

In Tomcat 4.0.x, a working value for me is \bin;[CATALINA_HOME]\common\lib

Tomcat 4.1.x seems to prefer +\common\endorsed

At least this seems to be the case on Windows.

If I'm feeling industrious, I'll give the tomcat plugin a hack and see if I can't get it to work with Tomcat 4.1.x. Perhaps someone else will beat me to it, if we're lucky.


Please sign in to leave a comment.