I think I’ve got DrJava working with the Java 7 compiler the way it should, even when started with the JRE (as long as the JDK is installed as well). That was the situation that both Corky and I got into when we double-clicked on DrJava.
Please give the weekly build drjava-weekly-20110822-r5448.jar a shot.
In the original JDK7 compiler adapter, I followed the instructions and
javax.tools.ToolProvider.getSystemJavaCompiler() method to get the Java compiler. Unfortunately, when a user starts DrJava with
the JRE, the tools.jar file is not on the boot classpath, and the
getSystemJavaCompiler() method will not find the
com.sun.tools.javac.api.JavacTool class, even when we later provide the tools.jar file to the class loader. The
javax.tools package cannot be shadowed, so we can’t load one version of it for one compiler and a different version for another compiler.
Instead of using
ToolProvider, I now do a
Class.forName("com.sun.tools.javac.api.JavacTool").newInstance() directly. That’s exactly what
ToolProvider is doing too, but we can shadow the
com.sun.tools.javac.* packages and have control over the classloader.
I’m sorry that it took this long. I had a long day on Friday and I’m on call this coming week; I wanted to make sure I have time to goof off and enjoy the beautiful weather this weekend.
If other issues come up, please let me know.