There are two varieties of JRE available. Java VM: IBM vs. Sun.
Is there a way to know which JRE I am using through JavaScript or some Java issued command.
As you are expecting it to know using the Javascript, I believe you want to know the JRE versioned being used in your browser. Hence you can include Java version tester applet which can exactly tell you the version of the current browser.
import java.applet.*;
import java.awt.*;
public class JavaVersionDisplayApplet extends Applet
{
private Label m_labVersionVendor;
public JavaVersionDisplayApplet() // Constructor
{
Color colFrameBackground = Color.pink;
this.setBackground(colFrameBackground);
m_labVersionVendor = new Label (" Java Version: " +
System.getProperty("java.version") +
" from "+System.getProperty("java.vendor"));
this.add(m_labVersionVendor);
}
}
Git Bash + Windows 10 + Software that came bundled with its own JRE copy:
Do a "Git Bash Here" in the jre/bin folder of the software you installed.
Then use "./java.exe -version" instead of "java -version" to get the information on the software's copy rather than the copy referenced by your PATH environment variable.
Get the version of the software installation: ./java.exe -version
JMIM@DESKTOP-JUDCNDL MINGW64 /c/DEV/PROG/EYE_DB/INST/jre/bin
$ ./java.exe -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Get the version in your PATH variable: java -version
JMIM@DESKTOP-JUDCNDL MINGW64 /c/DEV/PROG/EYE_DB/INST/jre/bin
$ java -version
java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode)
As for addressing the original question and getting vendor information:
./java.exe -XshowSettings:properties -version ## Software's copy
java -XshowSettings:properties -version ## Copy in PATH
The Java system property System.getProperty(...)
to consult is "java.runtime.name"
. This will distinguish between "OpenJDK Runtime Environment" and "Java(TM) SE Runtime Environment". They both have the same vendor - "Oracle Corporation".
This property is also included in the output for java -version
.