Skip to content

Commit ac40c39

Browse files
author
mgricken
committed
Still does not work when DrJava is launched by JRE, not JDK; does not
find JDK's compiler. However, at least this prevents the NullPointerException. git-svn-id: file:///tmp/test-svn/trunk@5446 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent 844c5b5 commit ac40c39

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

drjava/lib/platform.jar

36 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.

platform/src-jdk7/edu/rice/cs/drjava/model/compiler/Javac170Compiler.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
* @version $Id$
6767
*/
6868
public class Javac170Compiler extends JavacCompiler { // Javac170FilteringCompiler {
69+
6970
public Javac170Compiler(JavaVersion.FullVersion version, String location, List<? extends File> defaultBootClassPath) {
7071
super(version, location, defaultBootClassPath);
7172
}
@@ -81,12 +82,15 @@ public boolean isAvailable() {
8182
// javax.tools.Diagnostic and javax.lang.model.SourceVersion are also found in rt.jar;
8283
// to test if tools.jar is available, we need to test for a class only found in tools.jar
8384
Class.forName("com.sun.tools.javac.main.JavaCompiler");
84-
return true;
85+
86+
// Make sure the compiler returned is not null; this can happen if we have the JRE's library, not the JDK's.
87+
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
88+
89+
return (compiler != null);
8590
}
8691
catch (Exception e) { return false; }
8792
catch (LinkageError e) { return false; }
8893
}
89-
9094

9195
/** Compile the given files.
9296
* @param files Source files to compile.

0 commit comments

Comments
 (0)