1 Reply Latest reply on Apr 20, 2016 9:23 AM by Tomaz Cerar

    executing javac after run jboss as service

    omid pourhadi Apprentice

      Hi,

      When I run jboss as 7 as service I can not run javac in my web app but when I run jboss with standalon.sh I can do so.

       

      I get the error :

       

      javac no such file or directory, process exit

       

      How can I run javac in my web app when I run jboss as  service ?

       

      Process compile = Runtime.getRuntime().exec("javac ...");
      
      

       

      PS : I run everything as root

        • 1. Re: executing javac after run jboss as service
          Tomaz Cerar Master

          your service account has different paths configured.

           

          you should probably use some more "safe" way to locate javac.

           

          something along the lines of

           

          public static String getJavacPath() {

            String home = System.getenv("JAVA_HOME");

             if(home == null) {

            home = System.getProperty("java.home");

            }

             if(home != null) {

             return home + java.io.File.separator + "bin" + java.io.File.separator + "java";

            }

             return "javac";

          }