如何使用java应用程序检查jre版本 [英] how to check jre version using java application

查看:534
本文介绍了如何使用java应用程序检查jre版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在JDK7中创建了一个应用程序,但是jre6仍然在市场上使用,如果我将我的jar文件发送给jre6的人,它不会工作,有没有办法应用程序检查jre版本,如果它然后请求用户更新..

i have made an application in JDK7, but the jre6 is still using in the market, and if i send my jar file to someone with jre6, it wont work, is there a way that application checks the jre version and if it doesn't compat then ask user to update..

推荐答案

您可以使用 System.getProperty(String key); 使用java.version作为键的方法。

You can use System.getProperty(String key); method with "java.version" as key.

String version = System.getProperty("java.version");

示例输出:

1.6.0_30

可用的密钥可以在此处

这篇关于如何使用java应用程序检查jre版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆