Detect if JDK is installed?
Hi guys. So, I know that you can use System.getProperty for java.home, but there doesnt seem to be one of those for the JDK and I am currently working on a program that requires JDK. OR at least a part of it does... thats why I want to detect and dynamically change my program based on if JDK is installed or not. Can anyone tell me the best way to detect JDK? A quick google search doesnt really help tooo much.
Re: Detect if JDK is installed?
Assuming you wish the JDK to be on the PATH, use Runtime.exec to execute 'javac -version'. Get the returned value and check if it spits out the expected response (note, check the InputStream and ErrorStream)