> Does anyone know how to call the java compiler from within a java
> program and without using Runtime.exec()?

It is not a question specific to Java and *Linux*.
Here is not just proper place to ask it.


You can make use of the class sun.tools.javac.Main as:

  sun.tools.javac.Main javac = new sun.tools.javac.Main(System.out, "javac");
  javac.compile(new String[]{"Foo.java"});

Sun don't make the sun.* API open to the public.
We can't find usage of sun.* classes in Sun's documents.

With Java 2 SDK, you have to add tools.jar to your
classpath.  And on Win32, you have to specify a property
`env.class.path' to make javac find soruce codes.

  System.setProperty("env.class.path", System.getProperty("java.class.path"));


Kazuyuki SHUDO                          Happy Hacking!
  Muraoka Lab., Grad. School of Sci. & Eng., Waseda Univ.


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to