8 Replies Latest reply on Aug 10, 2005 6:30 PM by jiyanghu

    Running jboss-server from IDE, unable to find javac

    scooby

      Hi,

      When running the jboss server in debug mode from eclipse, it fails with:

      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

      however, the same jboss server runs fine when started from the command line.

      Where does the JAVA_HOME / classpath get set in eclipse? The environment variables that work when running from the command line, don't seem to make it through to the jboss server when it's run from eclipse.

      Eclipse 3.1.0
      JbossIDE 1.4.1
      Jboss 4.0.1

      Thanks,
      Sean

        • 1. Re: Running jboss-server from IDE, unable to find javac
          scooby

          Well... after digging a bit deeper I see that the java.home variable is set incorrectly in Eclipse, (as seen in Help / About / Details). For whatever reason eclipse is ignoring the JAVA_HOME variable as set in the environment and using the JRE home instead. This may have something to do with Java-1.5.0.

          Anyone know how to force eclipse to use a given java.home variable in this case?

          Thanks,
          Sean

          • 2. Re: Running jboss-server from IDE, unable to find javac
            scooby

            JAVA_HOME _is_ ignored.. have to use Windows / Preferences / Java / Installed JREs. Edit the default JRE, uncheck "Use default system libraries", then add external jar "tools.jar" in the jdk lib directory..

            Strange that this isn't configured properly out-of-the-box.

            Cheers,
            Sean

            • 3. Re: Running jboss-server from IDE, unable to find javac
              beamer908

               

              "scooby" wrote:
              JAVA_HOME _is_ ignored.. have to use Windows / Preferences / Java / Installed JREs. Edit the default JRE, uncheck "Use default system libraries", then add external jar "tools.jar" in the jdk lib directory..

              Strange that this isn't configured properly out-of-the-box.

              Cheers,
              Sean


              Recently had the same problem, and this fixed it. Anyone know what the difference is between the JDK JRE and the System JRE? Is it because the System JRE doesn't include the compiler? Also, any idea why the tools.jar is not included by default?

              Thanks,
              Bradley

              • 4. Re: Running jboss-server from IDE, unable to find javac
                peterj

                The JVM will attempt to find the necessary files using relative paths. In a JDK environment, the embedded JRE will find the necessary files because those files are in the correct relative locations. Tha tis not the case in a pure JRE environment.

                For example, java, jar, javac, etc will look for tools.jar at ../../lib/tools.jar and ../lib/tools.jar. Neither of these files exists in a pure JRE environment.

                • 5. Re: Running jboss-server from IDE, unable to find javac
                  mikek753

                   

                  "scooby" wrote:


                  Eclipse 3.1.0
                  JbossIDE 1.4.1
                  Jboss 4.0.1



                  That combination doesn't work
                  JBoss-IDE 1.5M2+ only works (I have some JSP editor problem) with Eclipse 3.1



                  • 6. Re: Running jboss-server from IDE, unable to find javac
                    beamer908

                     

                    "PeterJ" wrote:
                    The JVM will attempt to find the necessary files using relative paths. In a JDK environment, the embedded JRE will find the necessary files because those files are in the correct relative locations. Tha tis not the case in a pure JRE environment.

                    For example, java, jar, javac, etc will look for tools.jar at ../../lib/tools.jar and ../lib/tools.jar. Neither of these files exists in a pure JRE environment.


                    And yet, it was not enough to just point the Eclipse JRE to my JDK folder. I additionally had to follow his instructions and uncheck the "use system libraries" and add tools.jar explicitly. Why do you think that is?

                    • 7. Re: Running jboss-server from IDE, unable to find javac
                      peterj

                      What I described was for the default class loader. Eclipse uses a seperate class loader for your app so you have to tell it where the tools.jar is located so that it can prime that class loader.

                      • 8. Re: Running jboss-server from IDE, unable to find javac
                        jiyanghu

                        Go to Debug, in classpath you can specify where tools.jar can be found as user entry. Run JBoss once and then you can remove this entry. JBoss IDE now can "remember" where to find tools.jar to compile JSP.