Which JRE does C:\ProgramData\Oracle\Java\javapath\java.exe use?

jre 11 download
java exe the system cannot find the file specified
java environment
java sun
java 64-bit
jdk 1.8 0_181 download
jave
java classpath

I'm trying to figure out which environment variable java uses to find/detect the JRE used by C:\ProgramData\Oracle\Java\javapath\java.exe.

As per Oracle's design, the only files I have in the C:\ProgramData\Oracle\Java\javapath\ are

  • java.exe
  • javaw.exe
  • javaws.exe

If I set my JAVA_HOME to empty or to some random folder, running an application with java.exe still works. So I can only assume that it isn't using the JAVA_HOME value. So how does it find the JRE folder? Does it default to something specific? I have no JRE_HOME var set either.

This will give you an idea:

java -verbose | more

"The system cannot find the file C:\ProgramData\Oracle\Java , Java is using the path given in your PATH variable, which is, It may be pointing to the java.exe file from your previous jdk1.6.0_45 install. Either paste in mklink /d C:\ProgramData\Oracle\Java\javapath "C:\Program Files\Java\jdk1.8.0_40\bin\"​. The same would work for a JRE if that is all that is required. We will use this variable to restore PATH variable, and append JDK bin directory to the end. Now you don't have to worry about using different JDK in same system, when you need JDK 8 which is needed for many newer version of packages, for example Lucene 6.0.0 which was built with JDK 8, just execute jdk8.bat, and for the legacy systems, execute jdk7.bat, it will compatible with most of them.

Regular Directory with File Symlinks inside

If you look at the files in C:\ProgramData\Oracle\Java\javapath\ you will see that they are actually symlinks to a specific java binaries.

2015-11-13  06:11 PM    <SYMLINK>      java.exe [C:\Program Files\Java\jre1.8.0_65\bin\java.exe]
2015-11-13  06:11 PM    <SYMLINK>      javaw.exe [C:\Program Files\Java\jre1.8.0_65\bin\javaw.exe]
2015-11-13  06:11 PM    <SYMLINK>      javaws.exe [C:\Program Files\Java\jre1.8.0_65\bin\javaws.exe]
Directory Junction with regular Files inside

Using the latest (64! bit) install of Java 8 actually prepends onto the system path another location: c:\Program Files (x86)\Common Files\Oracle\Java\javapath. This time, the javapath itself is the junction:

2018-07-21  05:59 PM    <JUNCTION>     javapath [C:\Program Files (x86)\Common Files\Oracle\Java\javapath_target_172906453]
2018-07-21  05:59 PM    <DIR>          javapath_target_172906453

And now, interestingly, the java.exe etc. in the javapath_target_... folder are not symlinks. These files find JRE and JDK versions using this registry location:

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment]
"CurrentVersion"="1.8"

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8]
"JavaHome"="C:\\Program Files\\Java\\jre1.8.0_65"

Java SE 8 Update 171 Uses Different Windows Path, Java SE JDK and JRE - Version 8 and later: Java SE 8 Update 171 Uses When installing JRE 8 Update 171 for Windows x64, the Java installer (both .exe and C:\Program Files (x86)\Common Files\Oracle\Java\javapath and older) prepend the 64-bit path: C:\ProgramData\Oracle\Java\javapath to the  and if I do win-r then type java -version to check the version I get this message "c:\programdata\oracle\java\javapath\java.exe “ THE SPECIFIED PATH DOES NOT EXIST" if I go to C:\Program Files\Java\jre1.8.0_25\bin\java.exe I find my java where it has always been and it also shows under installed programs.

Oracle Java on Windows: C:\ProgramData\Oracle\Java\javapath, mklink java.exe "C:\Program Files\Java\jdk1.8.0_45\bin\java.exe" mklink The Oracle JDK/JRE installation on Windows normally goes very to the way Java is set up in various Linux flavours - using symbolic links to make it  The message is very clear on what the issue is: "The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe." The reason that the system is looking for that is because the C:\ProgramData\Oracle\Java\javapath\ directory is the first entry in the Path and the symbolic links in that directory point to a JRE 9 directory that doesn't exist (I only have the JDK 9 directory):

Try java -verbose with findstr

Example:

C:\>java -verbose 2>nul | findstr /I opened
[Opened C:\Program Files\Java\jre1.8.0_201\lib\rt.jar]
Try reg query with /s

Example:

C:\>reg query "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment" /s

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
    CurrentVersion    REG_SZ    1.8
    BrowserJavaVersion    REG_SZ    11.201.2

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8
    RuntimeLib    REG_SZ    C:\Program Files\Java\jre1.8.0_201\bin\server\jvm.dll
    JavaHome    REG_SZ    C:\Program Files\Java\jre1.8.0_201
    MicroVersion    REG_SZ    0

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8.0_201
    JavaHome    REG_SZ    C:\Program Files\Java\jre1.8.0_201
    MicroVersion    REG_SZ    0
    RuntimeLib    REG_SZ    C:\Program Files\Java\jre1.8.0_201\bin\server\jvm.dll

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8.0_201\MSI
    INSTALLDIR    REG_SZ    C:\Program Files\Java\jre1.8.0_201\
    JU    REG_SZ
    OEMUPDATE    REG_SZ
    FROMVERSION    REG_SZ    NA
    FROMVERSIONFULL    REG_SZ
    PRODUCTVERSION    REG_SZ    8.0.2010.9
    EULA    REG_SZ
    JAVAUPDATE    REG_SZ    1
    AUTOUPDATECHECK    REG_SZ    1
    AUTOUPDATEDELAY    REG_SZ
    FullVersion    REG_SZ    1.8.0_201-b09


C:\>
Try Get-Command java

Note: If you just care about the version number, then you might want to try PowerShell's Get-Command:

PS C:\> Get-Command java | ft -AutoSize

CommandType Name     Version   Source
----------- ----     -------   ------
Application java.exe 8.0.201.9 C:\Program Files (x86)\Common 
Files\Oracle\Java\javapath\java.exe

Oracle Java on Windows, Because this is an early release, I was not surprised when the issues with the main Java Runtime Environment (JRE) installation on my laptop. of C:\​ProgramData\Oracle\Java\javapath\java.exe as the first entry in my How to Delete the Record From the Database Using JdbcTemplate With Spring Boot. I'm trying to figure out which environment variable java uses to find/detect the JRE used by C:\ProgramData\Oracle\Java\javapath\java.exe. As per Oracle's design, the only files I have in the C:\ProgramData\Oracle\Java\javapath\ are . java.exe; javaw.exe; javaws.exe

How to set custom Java path after installing JDK 8 – Douglas C. Ayers, You can readily use the commands java or javac from the command prompt. to the Windows PATH variable C:\ProgramData\Oracle\Java\javapath . javaws.​exe files to C:\Windows\System32 directory, which is also in the  Also, I suspect the solution to the poster's problem was he needed to remove the existing "C:\ProgramData\Oracle\Java\javapath\java.exe." from his path. An uninstall + install of JRE may fix this too as the symlink is recreated. – SimplyInk Feb 20 '17 at 3:03

JDK 8 and C:\ProgramData\Oracle\Java\javapath - Java, Oracle is using a new way to set environment variable for JDK 8 on Windows. It contains three symlink files point to java.exe, javaw.exe and javaw.exe. First, delete C:\ProgramData\Oracle\Java\javapath, then prepare two bat files Gradle build in Eclipse: Can not find tools.jar · How to solve a JRE or JDK must be  The JDK includes the JRE which you can launch by using the java executable in the bin folder. You use this executable just like any other executable. When you type java in the command line it is actually shorthand. It searches your PATH until it finds the first matching java executable.

How to change Java version on Windows 10, From the above output we can deduce that C:\ProgramData\Oracle\Java\javapath is 1.8.0_66 . You need to change your PATH to put C:\Program Files\Java\jdk1. Oracle remove key "Java Runtime Environment" created by ojdkbuild if "JRE" is not checked during install Amazon Corretto uninstall and supress CurentVersion living it missing I think we definitly can't write/remove this key already shared by other vendor because uninstall will break other vendor and install can overrite other key

Comments
  • Did you look at you PATH environment variable?
  • @OldProgrammer sure. I have other java paths defined there. But will java.exe use the path env variable to find the necessary libs it requires? I would have expected it to need the JAVA_HOME var - and not expect it to use that PATH var. Normally, I would expect the PATH to be used to find executables. Furthermore, if I clear the PATH var to only have C:\ProgramData\Oracle\Java\javapath\ defined, java still runs.
  • I believe beside the path variable the java.exe in system32 used a regedit lookup. This behavior cost me a lot of hours of my life...
  • Thanks. It pointed me to the c:\Program Files(x86)\java folder. I'm still not sure I understand why it defaults to there, but at least I know where it is looking now.
  • Interestingly I tried changing the version via the registry, and then get Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion' has value '11.0.5', but '1.8' is required.
  • Actually WOW6432Node is the registry node used by 32-bit applications.