获取当前jre的文件路径 [英] get current jre's file path
本文介绍了获取当前jre的文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我们有两个Java应用程序A和B.应用程序A将调用应用程序B. 应用程序A已启动,但是当A调用B时,我不知道java_home或任何其他jre路径,我想获取运行在哪个jre应用程序A上,返回jre的执行文件的路径,这可能吗?
Suppose we have two java applications A and B. Application A will call application B. Application A has started, however when A calls B, I don't know the java_home or any other jre path, I want to get which jre application A is run on, return the jre's execution file's path, is this possible?
推荐答案
您可以通过请求系统属性java.home
:
You can get the installation directory for the JRE by requesting the system propertie java.home
:
String jrePath = System.getProperty("java.home");
有关系统属性的更多信息此处.
More on System Properties here.
这篇关于获取当前jre的文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文