XQEWR
XQEWR

Reputation: 638

How do I check a clients Java Version?

I want to create an Executable Jar file that when run, checks the currently installed version of Java on that computer and displays it for the user. I have searched online but in vain, I cannot find any code that allows a Jar file to check. I know that the Java website has it ( http://www.java.com/en/download/installed.jsp) I can't find a way to replicate it in Java Code. Any help would be very much appreciated.

Note: Sorry if this question is really stupid and has a really simple answer... I just spent half an hour trying to find a solution and I couldn't so I need your help! Thanks

Edit: I don't need the code for displaying it, just to get the version is enough for me thanks!

Upvotes: 0

Views: 500

Answers (2)

Petr Mensik
Petr Mensik

Reputation: 27496

Calling System.getProperty("java.version"); will give you version of the installed JRE which is what you want. Also take a look at other System properties, you may find some of them also useful.

Upvotes: 1

Kal
Kal

Reputation: 24910

System.getProperty("java.version");

Upvotes: 5

Related Questions