4 Replies Latest reply on Sep 3, 2007 4:44 PM by grandfatha

    JBoss on JDK to use JSR199

    marco.pehla

      Hello everybody,


      I need to compile generated Java source code on JBoss inside of a EJB3. I already migrated the JSR 199 compiler API of Java 7 to libraries that can be used in ordinary Java 5 standalone applications. The JSR 199 Java Compiler API works pretty well and does not need any access to the underlying file system. This is everything I need. But JBoss is running on a JRE, only Tomcat use the JDK.

      JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
      


      This is the reason why the compiler object in the code above is null.


      How can I run JBoss on a JDK. I couldn't be so difficult, or am I wrong?


      Thank you in advance,
      Marco

        • 1. Re: JBoss on JDK to use JSR199
          dimitris

          Why not point JAVA_HOME to a jdk ?

          • 2. Re: JBoss on JDK to use JSR199
            marco.pehla

            JAVA_HOME points to my JDK. When I type in SET in the console it shows:

            JAVA_HOME=C:\Programme\Java\jdk1.5.0_12
            

            But this is not the point. As far as I know does JBoss not really need a JDK to run. The JRE is absolute sufficient if everything is compiled, as I read in some other posts. The Java compiler is only necessary for Tomcat in order to compile JSP's.

            I could send you the two migrated JSR199 libraries. If you have time, you could try them in standalone applications and then e.g. in a EJB3 on JBoss.

            I guess that only JBoss need to use the tools.jar library. (I know that tools.jar is in the classpath and inside is the Java compiler. This is specified in the run.bat file.)



            • 3. Re: JBoss on JDK to use JSR199
              marco.pehla

              So finaly I tried the Java 6 SDK instead of Java 5 and the Java Compiler API (JSR 199) works! :D

              Now I can compile Java code in memory, without any file accessm inside of a EJB3.

              • 4. Re: JBoss on JDK to use JSR199
                grandfatha

                You need to compile java code inside an EJB? That sounds... unusual. ;)