Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8032576

tools.jar missing from classpath on Java 7 64-bit Windows JDK/JRE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P3 P3
    • None
    • 7u51
    • tools
    • windows_7

      FULL PRODUCT VERSION :
      Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
        ToolProvider.getSystemJavaCompiler() returns null on Windows with a 64-bit JDK/JRE. This happens when running a JRE inside or outside of the JDK and even if tools.jar is explicitly added to the classpath using -cp. The only way the JVM can find tools.jar in either use case is if it is added to the bootstrap classloader using Xbootclasspath.

      This works on UNIX and Windows 32-bit when either running within a JDK or by adding tools.jar to the classpath using -cp. It only occurs on Windows with the 64-bit Java 7 JDK/JRE. It does not happen with a Windows 64-bit Java 6 JDK/JRE.

      I did find bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6477844 which was incorrectly evaluated and closed. This is clearly a bug since it works on all other platforms and tools.jar is missing from the classpath unless Xbootclasspath is used.

      REGRESSION. Last worked in version 6u45

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Download a 64-bit 1.7.0_51 JDK.
      2. Compile the test case
      3. Run it from the JRE inside the JDK.
      4. Run it adding tools.jar to the classpath with -cp.
      5. Run it adding tools.jar to the classpath with -Xbootclasspath/p:
      6. Repeat steps 1-3 with a 32-bit 1.7.0_51 Windows JDK and it will work.
      7. Repeat steps 1-3 with a 64-bit 1.7.0_51 Solaris SPARC JDK and it will work.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
        ToolProvider.getSystemJavaCompiler() should return a JavaCompiler.
      ACTUAL -
        ToolProvider.getSystemJavaCompiler() returns null

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.tools.ToolProvider;
      import javax.tools.JavaCompiler;

      public class TestCompiler {
      public static void main(String[] args) {
      try {
      JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
      compiler.getSourceVersions();
      }
      catch (NullPointerException npe) {
      System.out.println("javax.tools.JavaCompiler could not be found");
      }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      -Xbootclasspath/p:c:\jdk_home\lib\tools.jar

            keshah Ketan Shah (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: