facebook

Unable to find a javac compiler with Tomact Launcher

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #196660 Reply

    Eric Glass
    Member

    I have the following configuration:
    Windows NT 4.0 with service pack 6a
    Sun Java 2 SDK 1.4.1_02
    Eclipse 2.1.0
    MyEclipse 2.1.1
    Tomact 5.0.3

    When I tried the tutorial and to reference the JSP I received the following messages:

    Jul 4, 2003 5:20:36 PM org.apache.jasper.compiler.Compiler generateClass
    SEVERE: Javac execption
    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)
    at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
    at

    Jul 4, 2003 5:20:36 PM org.apache.jasper.compiler.Compiler generateClass
    SEVERE: Error compiling file: D:\jakarta-tomcat-5_0_3\work\Catalina\localhost\HelloWorld\org\apache\jsp\helloWorld_jsp.java [javac] Compiling 1 source file

    Jul 4, 2003 5:20:37 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: Unable to compile class for JSP

    An error occurred at line: -1 in the jsp file: null

    Generated servlet error:
    [javac] Compiling 1 source file

    at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:120)

    I have my JAVA_HOME set to the root of the Java SDK, not the JRE.
    I have the tools.jar in my CLASSPATH environment settings.

    I tried the Sysdeo Tomcat Plugin and it worked with out any modifications.

    To get the MyEclipse Tomcat launcher to work properly with the JSP compilation, I had to add the tools.jar to the classpath of the launcher in the preferences.

    I hope this helps others that might have the same situation.

    Eric

    #196661 Reply

    Scott Anderson
    Participant

    Eric,

    To get the MyEclipse Tomcat launcher to work properly with the JSP compilation, I had to add the tools.jar to the classpath of the launcher in the preferences.

    Typically the cause of this error is that on the Tomcat->JDK preference page the JDK selected is pointed to the jre subdirectory rather than to the top JDK directory. I realize you set JAVA_HOME properly, but this isn’t really used, and neither is your environmental CLASSPATH setting.

    Would you verify your Tomcat->JDK setting and let us know whether or not this was the issue?

    I hope this helps others that might have the same situation.

    And I want to thank you for a very helpful post. You had already solved the problem you were seeing, but you took the time to thoroughly document it for others. This is a truly laudable act and we appreciate it.

    –Scott
    MyEclipse Support

    #196666 Reply

    Eric Glass
    Member

    Scott,

    Would you verify your Tomcat->JDK setting and let us know whether or not this was the issue?

    I have this set to my default defined in the preferences under Installed JREs.
    I found that it was using the default system libraries that does not include tools.jar, so I uncheck the Use checkbox and added the tools.jar with the Add External JARs… button.
    I removed the tools.jar from the Tomcat launcher Path and still had the same problem even with the modified default JRE.
    I found that the only way to get the JSPs to compile was to specifically add the tools.jar to the Tomat launcher Path in the preferences.
    Just a note, the first time I tried to start Tomcat with the launcher I did not have the JDK set in the preferences and received a message box telling me I need to have it set. So then that is when I went back into the preferences and set the JDK to the default JRE. I do not know if this made a difference or not in why I have to add the tools.jar to the Path.
    Eric

    #196670 Reply

    Scott Anderson
    Participant

    Eric,

    That confirms what I thought. Just adding tools.jar to your default JRE isn’t really enough. You really need to install a full JDK and point to the root directory of that. You’re obviously getting tools.jar from somewhere, so how about adding a new “JRE” for that JDK installation? If it’s the same as the default one, you can just retarget the root from the jre subdirectory to the top-level directory.

    –Scott
    MyEclipse Support

    #196671 Reply

    jerickson
    Member

    I had the same problem and thanks to Eric’s suggestion it now works. I do have the base of the SDK set as the JRE. Thr problem is that when you have Eclipse select the default libraries from the JDK it finds the JRE subfolder of the SDK and ignores the tools.jar which is locacted in the lib subfolder. I wish you would have included this work around in the documentation to save me some time searching the internet.

    #196672 Reply

    Scott Anderson
    Participant

    Good feedback. We’ll make the documentation more explicit in this regard.

    –Scott
    MyEclipse Support

    #196675 Reply

    Eric Glass
    Member

    Scott,

    I too have my default JRE in Eclipse set to the root directory of Sun 2 SDK 1.4.1_02, not to the sub-directory with the JRE, but Eclipse uses only the libraries from the JRE as a default. I even tried adding the tools.jar to the list of libraries available in the default JRE and the Tomact launcher still did not find it.

    Eric

    #196676 Reply

    Scott Anderson
    Participant

    That’s really rather peculiar, typically it works without the addional configuration even when tools.jar is not listed in the libs used. However, we noticed that it never works without tools.jar on Linux so the GA release will automatically add tools.jar from you JDK to the classpath on launch. Should make things much easier for all.

    Thanks again for all the feedback. The product will continue to improve as a result.

    –Scott
    MyEclipse Support

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Unable to find a javac compiler with Tomact Launcher

You must be logged in to post in the forum log in