Brodie Brodie - 2 years ago 106
Java Question

Does depend on the JDK?

I want to use

to dynamically create some classes.

I found the source code of the
package, but there is no implementation; some posts on the internet say it depends on
, I am not sure
associates with JRE.

So, can I run the program in a JRE environment without JDK installed?

Another question, what is the implementation detail of
, is it creating a new process to invoke the


Answer Source

JRE's need to include the interfaces, and classes in that package, but do not need to provide implementations.

Sun's JRE doesn't, and returns null from calling ToolProvider.getSystemJavaCompiler().

This other question addresses java 5.

Here's a blog post by Morten Nobel-Jørgensen on how to use eclipse's compiler as an implementation of

JavaCompiler javac = new EclipseCompiler();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download