• <small id='k1GOV'></small><noframes id='k1GOV'>

    <tfoot id='k1GOV'></tfoot>

    1. <legend id='k1GOV'><style id='k1GOV'><dir id='k1GOV'><q id='k1GOV'></q></dir></style></legend>
        <i id='k1GOV'><tr id='k1GOV'><dt id='k1GOV'><q id='k1GOV'><span id='k1GOV'><b id='k1GOV'><form id='k1GOV'><ins id='k1GOV'></ins><ul id='k1GOV'></ul><sub id='k1GOV'></sub></form><legend id='k1GOV'></legend><bdo id='k1GOV'><pre id='k1GOV'><center id='k1GOV'></center></pre></bdo></b><th id='k1GOV'></th></span></q></dt></tr></i><div id='k1GOV'><tfoot id='k1GOV'></tfoot><dl id='k1GOV'><fieldset id='k1GOV'></fieldset></dl></div>

        • <bdo id='k1GOV'></bdo><ul id='k1GOV'></ul>

      1. 在运行时确定 JVM 可执行文件的位置

        Determining location of JVM executable during runtime(在运行时确定 JVM 可执行文件的位置)
          <tbody id='0aD1U'></tbody>
        <i id='0aD1U'><tr id='0aD1U'><dt id='0aD1U'><q id='0aD1U'><span id='0aD1U'><b id='0aD1U'><form id='0aD1U'><ins id='0aD1U'></ins><ul id='0aD1U'></ul><sub id='0aD1U'></sub></form><legend id='0aD1U'></legend><bdo id='0aD1U'><pre id='0aD1U'><center id='0aD1U'></center></pre></bdo></b><th id='0aD1U'></th></span></q></dt></tr></i><div id='0aD1U'><tfoot id='0aD1U'></tfoot><dl id='0aD1U'><fieldset id='0aD1U'></fieldset></dl></div>
        <legend id='0aD1U'><style id='0aD1U'><dir id='0aD1U'><q id='0aD1U'></q></dir></style></legend>

          • <tfoot id='0aD1U'></tfoot>
              • <bdo id='0aD1U'></bdo><ul id='0aD1U'></ul>

                  <small id='0aD1U'></small><noframes id='0aD1U'>

                  本文介绍了在运行时确定 JVM 可执行文件的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何在运行时获取当前运行的JVM的可执行文件的位置?我想使用 ProcessBuilder 类将另一个 JVM 实例化为子进程.

                  How does one obtain the location of the executable of the currently running JVM during runtime? I would like to instantiate another JVM as a subprocess using the ProcessBuilder class.

                  我知道有 java.home 系统属性,但这并没有指定 JVM 可执行文件的位置.我知道我可以做这样的事情来获得路径:

                  I am aware that there is the java.home System property, but this doesn't specify the location of the JVM executable. I understand I could do something like this to get the path:

                  System.getProperties().getProperty("java.home") + File.pathSeparator + "bin" + File.pathSeparator + "java"

                  此代码与平台无关,因为 Windows 可执行文件的名称是 java.exe,而不是 java.有没有办法获取考虑平台特性的 JVM 可执行文件的路径?

                  This code isn't platform independent, because the Windows executable's name is java.exe, not java. Is there a way to get the path of the JVM executable that takes the platform's idiosyncrasies into account?

                  推荐答案

                  您总是可以只使用 os.name 来检查用户是否在运行 Windows.这将在

                  You could always just use os.name to check if the user is running Windows or not. That'll work on OS X, Linux and Windows at

                  String jvm_location;
                  if (System.getProperty("os.name").startsWith("Win")) {
                      jvm_location = System.getProperties().getProperty("java.home") + File.separator + "bin" + File.separator + "java.exe";
                  } else {
                      jvm_location = System.getProperties().getProperty("java.home") + File.separator + "bin" + File.separator + "java";
                  }
                  

                  这篇关于在运行时确定 JVM 可执行文件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)

                  <legend id='Yigde'><style id='Yigde'><dir id='Yigde'><q id='Yigde'></q></dir></style></legend>
                1. <small id='Yigde'></small><noframes id='Yigde'>

                  <tfoot id='Yigde'></tfoot>

                          <tbody id='Yigde'></tbody>
                        <i id='Yigde'><tr id='Yigde'><dt id='Yigde'><q id='Yigde'><span id='Yigde'><b id='Yigde'><form id='Yigde'><ins id='Yigde'></ins><ul id='Yigde'></ul><sub id='Yigde'></sub></form><legend id='Yigde'></legend><bdo id='Yigde'><pre id='Yigde'><center id='Yigde'></center></pre></bdo></b><th id='Yigde'></th></span></q></dt></tr></i><div id='Yigde'><tfoot id='Yigde'></tfoot><dl id='Yigde'><fieldset id='Yigde'></fieldset></dl></div>
                          <bdo id='Yigde'></bdo><ul id='Yigde'></ul>