Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Detect if JDK is installed?

  1. #1
    Member
    Join Date
    Feb 2013
    Posts
    78
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default 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.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default 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)

Similar Threads

  1. [SOLVED] Installed Android program which I created bombs out
    By HanneSThEGreaT in forum What's Wrong With My Code?
    Replies: 20
    Last Post: July 12th, 2013, 04:40 AM
  2. Replies: 0
    Last Post: December 12th, 2012, 09:02 PM
  3. GWT SDK not installed
    By Carhartt in forum Java IDEs
    Replies: 1
    Last Post: April 24th, 2012, 04:16 PM
  4. jdk is not installed properly error..
    By bczm8703 in forum Java SE APIs
    Replies: 6
    Last Post: June 1st, 2011, 06:33 AM
  5. Using 1.5 jre/webstart on a computer with 1.6 installed
    By qman32 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 27th, 2011, 12:29 PM