0

I'm preparing for a Tomcat installation. I'm in a DEV environment, and need to install the JDK which also includes JRE. I've had success, but I think I have some weird PATH issues. I was referencing - not explicitly - the instructions here.

  1. JDK install path - C:\java
  2. JRE install path - C:\java\jre
  3. JAVA_HOME variable - C:\java
  4. PATH var (top of list) - C:\java\bin
  5. PATH also includes - C:\Program Files (x86)\Common Files\Oracle\Java\javapath

When I test from the command line to see if things are OK with java -version, I get this error:

<JAVA_HOME>/lib/ext exists, extensions mechanism no longer supported; Use - 
classpath instead.
.Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

However, if I manually browse to C:\java\jre\bin, and run java -version, it tells me the version just fine, no errors.

It's when I run java -version from C:\java\bin\ where I have the issue.

What's the difference between the java.exe in JRE and JDK? Why is the JDK java.exe so unhappy?

NamedArray
  • 773
  • 3
  • 10
  • 25

1 Answers1

0

I wish to answer my own question for posterity, with the hopes it might help someone else, like myself, who is newer to understanding the Tomcat's requirements for Java.

Here are my observations:

  • Ultimately, I was trying to do a fresh install into an old, "dirty", java folder. I started with a brand new folder, and that pretty much fixed all the problems. I didn't get the error referenced in my original question when running java -version.
  • Specifying the JRE_PATH and JAVA_PATH for Tomcat may be totally unnecessary at this point. These are environmental variables for Windows cmd, and can be referenced by other applications, like Tomcat, during installation.
  • The JRE_PATH and JAVA_PATH are env variables and have nothing to do with PATH
  • JDK/JRE installation adds C:\Program Files (x86)\Common Files\Oracle\Java\javapath to the PATH. Somehow, the 3 executables in that folder just know where the real Java folder structure is. There are corresponding registry keys that define the location of the folder structure.
  • Even without specifying the JRE_PATH, Tomcat was able to pick out the location of the JRE correctly
  • For Tomcat's purposes, I don't believe it matters if you use the Java.exe from the JDK or the JRE, because, they seem to be the same

Resources:

https://docs.oracle.com/javase/9/install/installation-jdk-and-jre-microsoft-windows-platforms.htm#JSJIG-GUID-29333CFD-E7A6-498B-9317-97700C81D928

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

https://www3.ntu.edu.sg/home/ehchua/programming/howto/JDK_Howto.html

JDK java executable vs JRE executable

NamedArray
  • 773
  • 3
  • 10
  • 25