[英]Get path to java JRE
可以獲取用於當前進程的 jre 的位置。 需要將其他 Java 應用程序作為單獨的進程啟動。 有不同的 jre 可用(並且沒有設置路徑變量)我想問例如。 裝載機。 在 Solaris、Linux、Windows 上運行。
您可以使用:
System.getProperty("java.home")
http://download.oracle.com/javase/6/docs/api/java/lang/System.html#getProperties%28%29說:
java.home:Java安裝目錄
System.getProperty("java.home")
System.out.println(System.getProperty("java.home"));
上面的代碼將返回當前 jvm 的 jre 路徑的完整物理路徑。 僅在 Windows 10 中測試。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.