0

I did exactly as this SO post suggested, and ran the command java -XshowSettings:properties -version. This does outputs a wealth of information on my console, but there is this %JRE_HOME%\bin sitting on one line, which means that it looked up for JRE_HOME but was unable to find any corresponding value.

EDIT 1 :START

Output of above command :


    java.library.path = C:\Softwares\java\AdoptOpenJDK\JDK-11\OpenJDK11U-jdk_x64_windows_hotspot_11.0.10_9\jdk-11.0.10+9\bin
        C:\WINDOWS\Sun\Java\bin
        .
        .
        .
        C:\Softwares\Gradle\gradle-6.8.1-all\gradle-6.8.1\bin
        C:\Softwares\java\AdoptOpenJDK\JDK-11\OpenJDK11U-jdk_x64_windows_hotspot_11.0.10_9\jdk-11.0.10+9\bin
        %JRE_HOME%\bin
        C:\Softwares\Groovy\apache-groovy-sdk-3.0.0\bin
        .
        .
        .
        .
        .
    java.runtime.name = OpenJDK Runtime Environment
    java.runtime.version = 11.0.10+9
    java.specification.name = Java Platform API Specification

EDIT 1 : END

My JDK version :

>java -version
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)

I know that the JRE no more comes bundled in a separate jre directory as it used to upto JDK 8. I went through several posts on SO in search for any guidance on setting up a JRE for JDK 11, but that doesn't help as none explains whether JRE_HOME is actually required to be setup for any other services/apps to function correctly.

Why does running the above command complain about not having JRE_HOME ?

However Spring STS does not complain when I point its JRE Home to the java home directory.

Asif Kamran Malick
  • 2,409
  • 3
  • 25
  • 47
  • "...sitting on one line " which property that line belonged to? `java.library.path` or `sun.boot.library.path` – the Hutt Apr 08 '21 at 06:53
  • It's `java.library.path`. I have just updated my post. – Asif Kamran Malick Apr 08 '21 at 07:06
  • 1
    Java never required a `JRE_HOME` variable. Similar to `JAVA_HOME`, it’s just a convention established by 3rd party applications. The most likely reason to have `%JRE_HOME%\bin` in the `java.library.path` system property is that someone set the `PATH` variable to contain `%JRE_HOME%\bin`. I don’t see where the command “complains” about the absent entry. You can have as many non-existent entries in your path as you like, the worst thing that can happen, is a slight slowdown when searching for libraries. Thankfully, Java is smart enough to put its own library location at the beginning of the path – Holger Apr 08 '21 at 09:28
  • Maybe I'm missing something here. But even though the Java library location comes first in the sequence, what if any services/apps still use `%JRE_HOME%` env variable to get hold of the executable. Will this then cause any of the apps/services to break. If yes, then how should I set up my %JRE_HOME%. Should I follow the Spring STS approach and point my `JRE_HOME` to the %JAVA_HOME%. I am just looking for a way to mitigate this. – Asif Kamran Malick Apr 08 '21 at 09:38
  • 1
    Of course, that depends on how the particular application uses `JRE_HOME` and what it expects to find there. Perhaps, all it does, is adding `%JRE_HOME%\bin` to `PATH`, thinking that it was useful. Perhaps, it tries to find a file there that doesn’t exists in JDK 11 at all. The first does not require any action, the second scenario is unsolvable without updating or replacing the particular software. Of course, there’s a wide span in-between these scenarios. It’s impossible to tell without knowing the application. – Holger Apr 08 '21 at 09:46
  • Thank you so much. So I'm not going to care about the `JRE_HOME` as of now and remove it from my environment variables. if any apps complain will try to resolve it accordingly. Just curious, why Spring STS is fine with JRE_HOME being same as JAVA_HOME and adds `%JAVA_HOME\lib\jrt-fs.jar%`. I'm talking about the `JRE Window under STS ->WIndow-> Preferences`. Why does it still look for `JRE_HOME`, when it should be caring about just `JAVA_HOME`. This behavior itself gave rise to my question. Other wise I was fine with just ignoring the `JRE_HOME`. – Asif Kamran Malick Apr 08 '21 at 09:56

1 Answers1

0

Set the same path as jdk in the JRE_Home variable.

  • 1
    Thank you, but this doesn't answer my concern. I could have followed the Spring STS and done that, but I'm really looking for an explanation. – Asif Kamran Malick Apr 08 '21 at 09:41