如何检测客户端机器是否已经安装了JRE版本? [英] How to detect whether client machine is already has installed version of JRE or not?
问题描述
在应用程序中,我们提供客户端选择是否使用JRE下载应用程序的功能。如果可以检测客户端系统是否已经配置了JRE,则可以为此功能提供更加用户友好的操作。
In an application we provide the capability of client for choosing downloading our application with a JRE or not. IF it is possible to detect whether client system is already configured with a JRE or not, it is possible to provide this feature more user friendly mannaer.
推荐答案
无法绝对确定是否已经安装了JRE:
It is not possible to tell with absolute certainty if a JRE is already installed:
- JRE可能安装在奇怪的地方,
- 它可能安装在用户无法访问的目录中,或者
- 它可能安装在可移动驱动器上......在需要时不会出现这种情况。
搜索整个目录树的速度很慢,并且不一定会找到任何内容。用户可能会变得相当不耐烦...
Searching the entire directory tree is slow, and won't necessarily find anything. The user may get rather impatient ...
即使您确实找到了JRE,也不清楚您应该在没有用户说的情况下使用它。
Even if you do find a JRE, it is not clear that you should use it without the user's say-so.
- 是否是用户想要使用的Java版本?
- 它是否有最新的安全修复程序?
- 可能是乱了吗?它可能在其证书商店中有垃圾证书,或在背书目录中有危险的东西,还是更糟?
可能最安全的事情是只是查看用户的PATH。如果路径上有JRE,那么用户(或他的系统管理员)将其放在那里是一个安全的选择。
Probably the safest thing is to just look at the user's PATH. If there is a JRE on the path, it is a safe bet that the user (or his system administrator) put it there.
这篇关于如何检测客户端机器是否已经安装了JRE版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!