简体   繁体   中英

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!

System.getProperty("java.version");

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM