<tfoot id='vvqAy'></tfoot>

    • <bdo id='vvqAy'></bdo><ul id='vvqAy'></ul>
    <legend id='vvqAy'><style id='vvqAy'><dir id='vvqAy'><q id='vvqAy'></q></dir></style></legend>

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

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

        Java Attach API:动态更改 java.library.path

        Java Attach API: changing java.library.path dynamically(Java Attach API:动态更改 java.library.path)
        • <bdo id='pD5yj'></bdo><ul id='pD5yj'></ul>
          <tfoot id='pD5yj'></tfoot>
          <i id='pD5yj'><tr id='pD5yj'><dt id='pD5yj'><q id='pD5yj'><span id='pD5yj'><b id='pD5yj'><form id='pD5yj'><ins id='pD5yj'></ins><ul id='pD5yj'></ul><sub id='pD5yj'></sub></form><legend id='pD5yj'></legend><bdo id='pD5yj'><pre id='pD5yj'><center id='pD5yj'></center></pre></bdo></b><th id='pD5yj'></th></span></q></dt></tr></i><div id='pD5yj'><tfoot id='pD5yj'></tfoot><dl id='pD5yj'><fieldset id='pD5yj'></fieldset></dl></div>

            <small id='pD5yj'></small><noframes id='pD5yj'>

          1. <legend id='pD5yj'><style id='pD5yj'><dir id='pD5yj'><q id='pD5yj'></q></dir></style></legend>

                <tbody id='pD5yj'></tbody>

                  本文介绍了Java Attach API:动态更改 java.library.path的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在我的 Windows 机器上使用 com.sun.tools.attach API 时,我在调用时收到以下错误

                  When using the com.sun.tools.attach API on my Windows machine, I get the following error when making a call to

                  VirtualMachine.list()
                  

                  java.lang.UnsatisfiedLinkError:java.library.path 中没有附加

                  原因是缺少 attach.dll.attach.dll 位于 $JRE/bin/ 中.当使用 -Djava.library.path=[Directory to the attach.dll] 启动我的 Java 程序时,一切正常,没有错误输出.

                  The reason is the missing attach.dll. The attach.dll is located in $JRE/bin/. When starting my Java program with -Djava.library.path=[Directory to the attach.dll] everything works out without error output.

                  现在,我不想在每个 Java 程序启动时都添加这个丑陋的 JVM 参数.因此我的问题是:

                  Now, I don't want to add every Java program start this ugly JVM parameter. Therefore my questions are:

                  1. 我的机器配置不正确,$JRE/bin/ 应该在库路径中吗?

                  如果没有,如何动态添加路径?System.setProperties("java.library.path",StringOfThePathToTheAttach.dll); 行不通.库路径已更改,但仍然出现错误.这是否与 SecurityManager 或 JVM 启动有关?

                  If not, how can I add the path dynamically? System.setProperties("java.library.path",StringOfThePathToTheAttach.dll); does not work out. The library path is changed, but the error apperas anyway. Has this something to do with SecurityManager or JVM start up?

                  推荐答案

                  您的 System.setProperty("java.library.path", StringOfThePathToTheAttach.dll); 应该可以工作.我的猜测是你打电话太晚了.换句话说,在您设置属性之前尝试访问 DLL.

                  Your System.setProperty("java.library.path", StringOfThePathToTheAttach.dll); should work. My guess is that you're calling it too late. In other words, there is an attempt to access the DLL prior to you setting the property.

                  您能否在代码中设置属性之后以及在违规方法调用之前再次输出 java.library.path 的当前值?

                  Can you output the current value for java.library.path after the property is set in code and again before the offending method call?

                  即如果您在看到设置属性后"之前看到在 attach.dll 调用之前"输出,那么您就知道问题出在哪里了.

                  i.e. If you see "Before attach.dll call" output prior to seeing "After setting property", you know where your problem is.

                  指向本机库的更好方法是使用 System.load(StringOfThePathToTheAttach.dll) - 再次,在有问题的代码行之前.

                  A better way to point to native libraries is to use System.load(StringOfThePathToTheAttach.dll) - again, before the offending line of code.

                  这篇关于Java Attach API:动态更改 java.library.path的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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='K37aV'><style id='K37aV'><dir id='K37aV'><q id='K37aV'></q></dir></style></legend>
                    <i id='K37aV'><tr id='K37aV'><dt id='K37aV'><q id='K37aV'><span id='K37aV'><b id='K37aV'><form id='K37aV'><ins id='K37aV'></ins><ul id='K37aV'></ul><sub id='K37aV'></sub></form><legend id='K37aV'></legend><bdo id='K37aV'><pre id='K37aV'><center id='K37aV'></center></pre></bdo></b><th id='K37aV'></th></span></q></dt></tr></i><div id='K37aV'><tfoot id='K37aV'></tfoot><dl id='K37aV'><fieldset id='K37aV'></fieldset></dl></div>

                        <tbody id='K37aV'></tbody>

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

                        <small id='K37aV'></small><noframes id='K37aV'>

                          <tfoot id='K37aV'></tfoot>