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

Non-admin javac execution fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • 6-pool
    • 6
    • tools
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0_05"
      Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
      Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      JAVA_HOME=h:\jre1.6.0
      JAVA_VERSION=1.6

      A DESCRIPTION OF THE PROBLEM :
      If I try - on a machine preinstalled with jdk version 1.5.X - to run the javac.exe or other executables from my private non-admin (CANNOT EDIT REGISTRY entries or similar) jdk 1.6.0 installation, it fails with the message:

      Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
      has value '1.5', but '1.6' is required.
      Error: could not find java.dll
      Error: could not find Java 2 Runtime Environment.

      I tried (1.6.0_04-b12 is the version I loaded for jdk):

      H:\jre1.6.0>java -version
      java version "1.6.0_05"
      Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
      Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)

      H:\jre1.6.0>java -version:1.6.0_05-b13 -version
      java version "1.6.0_05"
      Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
      Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)

      H:\jre1.6.0>cd ..\jdk1.6.0\bin

      H:\jdk1.6.0\bin>javac -version:1.6.0_04-b12
      Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
      has value '1.5', but '1.6' is required.
      Error: could not find java.dll
      Error: could not find Java 2 Runtime Environment.

      H:\jdk1.6.0\bin>javadoc -version:1.6.0_04-b12
      Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
      has value '1.5', but '1.6' is required.
      Error: could not find java.dll
      Error: could not find Java 2 Runtime Environment.


      It should be possible to override that behaviour by setting environment variables or similar without relying on administrative permissions. The usage of the asssociated jdk 1.6.0 is needed i. e. by javadoc.exe, jar.exe and other important tools needed not only by administrators.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Administrator preinstalled jdk version 1.5.X, is not changeable

      Non-Admin loaded jdk 6 (javac -version:1.6.0_04-b12)

      Non-Admin loaded jre 6 (java -version:1.6.0_05-b13)

      With the variables JAVA_VERSION, JRE_HOME, JAVA_HOME, PATH adapted to find that versions binaries first, Non-Admin executed java.exe -> no problem, executed {javac.exe, javadoc.exe, ...} -> Above described failure occured.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      That javac.exe will use the binaries and libraries locations derived from the given path entries to execute, and so different version pairs of JAVA (e.g. jre/jdk 5 and jre/jdk 6) are possible at a system, like with many other tools where user settings override system level settings.
      ACTUAL -
      H:\jre1.6.0>java -version:1.6.0_05-b13 -version
      java version "1.6.0_05"
      Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
      Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)

      H:\jdk1.6.0\bin>javac -version:1.6.0_04-b12
      Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
      has value '1.5', but '1.6' is required.
      Error: could not find java.dll
      Error: could not find Java 2 Runtime Environment.

      H:\jre1.6.0>H:\jdk1.6.0\bin\javac -version:1.6.0_05-b13 -version
      Unable to locate JRE meeting specification "1.6.0_05-b13"

      H:\jre1.6.0>H:\jdk1.6.0\bin\javac -version:1.6.0_04-b12 -version
      Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
      has value '1.5', but '1.6' is required.
      Error: could not find java.dll
      Error: could not find Java 2 Runtime Environment.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      H:\jre1.6.0>java -version:1.6.0_05-b13 -version
      java version "1.6.0_05"
      Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
      Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)

      H:\jdk1.6.0\bin>javac -version:1.6.0_04-b12
      Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
      has value '1.5', but '1.6' is required.
      Error: could not find java.dll
      Error: could not find Java 2 Runtime Environment.

      H:\jre1.6.0>H:\jdk1.6.0\bin\javac -version:1.6.0_05-b13 -version
      Unable to locate JRE meeting specification "1.6.0_05-b13"

      H:\jre1.6.0>H:\jdk1.6.0\bin\javac -version:1.6.0_04-b12 -version
      Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
      has value '1.5', but '1.6' is required.
      Error: could not find java.dll
      Error: could not find Java 2 Runtime Environment.

      REPRODUCIBILITY :
      This bug can be reproduced always.

            ksrini Kumar Srinivasan
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: