DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17888>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17888 Unable to find a javac compiler Summary: Unable to find a javac compiler Product: Tomcat 4 Version: 4.1.18 Platform: PC OS/Version: Windows XP Status: NEW Severity: Blocker Priority: Other Component: Unknown AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I am trying to run tomcat 4.1.18 with new installs of ant 1.5.2 and j2sdk 1.4.1_02. I keep getting errors. When trying to run a webapp on Tomcat, I get the following error messages from ANT: 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.getCom piler(CompilerAdapterFactory.java:139) at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:833) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682) This is followed by other error messages up the call-chain. JAVA_HOME is defined as C:\j2sdk1.4.1_02, which is correct. Also C:\j2sdk1.4.1_02\bin has been added to the path variable (as has %ANT_HOME%\bin). It seems that Tomcat invokes Jasper to compile something when starting a webapp (in this case, the examples page -- index.jsp) and Jasper calls Ant, which generates the first error message saying it can't find javac. Ant's CompilerAdapterFactory class uses a number of tests to determine the compiler in use. The doesModernCompilerExist method is supposed to distinguish between sun javac before 1.3 and after (I think). Running j2sdk 1.4.1_02, I compiled and ran the following code (which does the same test as doesModernCompilerExist): class TestComp { public static void main(String[] arguments) { try { Class.forName("com.sun.tools.javac.Main"); System.out.println("found com.sun.tools.javac.Main"); } catch (ClassNotFoundException cnfe) { System.out.println("did not find com.sun.tools.javac.Main"); } } } The output from this is "did not find com.sun.tools.javac.Main". I tested this on j2sdk 1.4.0_03 with the same result. Initially I thought this might be a problem in Ant and I filed a bugzilla report with them (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17857). That was answered by Conor MacNeill, who said: You should probably raise this on the tomcat bugZilla. I'm not really sure how the Tomcat folks have configured Jasper to use Ant's javac task. The most obvious thing to check is that tools.jar is available in the classpath whereever Tomcat expects it to be since it contains the compiler classes. I have found that tools.jar is in <JAVA_HOME>\lib, which seems to be correct. This may not be an Tomcat bug, but I've tried lots of things and I'm hoping you have a suggestion. Thanks. Jim --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]