I am building a application where user can change the Java setting and can point to any jdk. However it must be Oracle JDK and shouldn't be a openJDK. Is there any way to check whether the JDK is open JDK or Oracle JDK given its java path c:\bin\jdk\binjava.exe ?
The easiest way would be to System.exec()
c:\bin\jdk\bin\java.exe -version
and parse it's output. OpenJDK and Sun JDK have different text outputs.
This is not optimal, but consider: Even if you find a difference in classname, functionality or similar, it would still only work for certain versions. You could never rely on a difference staying different.
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