JDK-6477844 : ToolProvider.getSystemJavaCompiler returns null
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2006-10-03
  • Updated: 2014-01-23
  • Resolved: 2008-02-13
Description
FULL PRODUCT VERSION :
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b100)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b100, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
ToolProvider.getSystemJavaCompiler returns null. This is a expected behavior if a compiler isn't supported by the runtime, according to the javadoc. However, installing the lastest Mustang on two identical windows 2000 systems renders different behaviors. Machine A, everything works as expected. Machine B, no compiler available.

REGRESSION.  Last worked in version mustang

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Attempt to get the system java compiler
In some instances it's null

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Sun's Java runtime should always return a compiler.
ACTUAL -
Null sometimes

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Altough this is crictical error the method used returns null instead of throwing an exception!

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.tools.*;

public class Test
{
public static void main(String ... args)
{
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
System.out.println(compiler);
}
}

---------- END SOURCE ----------

Comments
EVALUATION Bases on the SDN comments, I agree the problem can be reproduced if the given test program is run with JRE instead of JDK. Assuming that this is the problem the submitter ran into, I am change the Close substatus from "Not reproducible" to "Not a defect".
13-02-2008