I tried googling the answer, but all I found was tips on how to detect Java from a browser or the very generic way of just starting Java and see if it runs, which introduces a possibly long delay in my application. (~ two seconds when started the very first time on my machine)
I hope there is a faster way, if the following restrictions apply:
This detection is not meant for a public application, but for internal use on Windows platforms only.
Is there a registry path I can read or some configuration file I can parse?
You might have either JRE(Java Runtime Environment) which is required to run java applications on the computer or JDK as shown below. 1. Open command prompt and enter “java –version”. If installed version number is displayed.
The default installation directory of a static JRE is C:\Program Files (x86)\Java\jre n (for 32-bit versions) or C:\Program Files\Java\jre n (for 64-bit versions), where n is the full Java SE release and update number (for example, n = 1.8.
JRE_HOME. C:\Program Files\Java\jre<version>
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
Windows > Start > cmd >
C:> for %i in (java.exe) do @echo. %~$PATH:i
If you have a JRE installed, the Path is displayed,
for example: C:\Windows\System32\java.exe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With