java JVM 1.8下远程调试java web start
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26668723/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Remote debugging java web start under JVM 1.8
提问by Ivan Tamashevich
I have a Java Web Start application, which I used to start through a shortcut:
我有一个 Java Web Start 应用程序,我曾经通过快捷方式启动它:
"C:\Program Files\Java\jdk1.7.0_67\bin\javaws.exe" -J-Dfile.encoding=UTF-8 -J-Xdebug -J-Xnoagent -J-Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=8200" http://xxx/yyy/zzz.jnlp
But after installing JDK 1.8 it all stopped working, my javaws don't see any of additional X||D params. I tried this way:
但是在安装 JDK 1.8 之后它都停止工作了,我的 javaws 没有看到任何额外的 X||D 参数。我试过这种方式:
setenv JAVAWS_VM_ARGS "-Dfile.encoding=UTF-8 -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=8200"
"C:\Program Files\Java\jdk1.8.0_25\bin\javaws.exe" http://pont/dms/InstallDMS_debug.jnlp
But no use.
但是没有用。
The only solution I found is to set params using Java control panel, adding them directly to JVM.
我找到的唯一解决方案是使用 Java 控制面板设置参数,将它们直接添加到 JVM。
Control Panel > Java > Java (tab) > View (button) > Runtime parameters (field)
How can I set params for 1.8 good old way?
如何为 1.8 好旧方式设置参数?
P.S. JDK 1.6 x32 still works well with shortcuts. x64 1.7 starts but references to 1.8 libs, so I think all JDK x64 are in collusion.
PS JDK 1.6 x32 仍然适用于快捷方式。x64 1.7 开始但引用了 1.8 库,所以我认为所有 JDK x64 都在勾结。
采纳答案by Ivan Tamashevich
After all it still works with
毕竟它仍然适用于
set JAVA_TOOLS=-agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=y
in bat file.
在bat文件中。
回答by roof
Starting from the (approximately) version 1.7.0_022 java web start launcher significantly alters list of supplied JVM-arguments and properties by treating vast of them as unsecured.
从(大约)版本 1.7.0_022 开始,java web start 启动器显着改变了提供的 JVM 参数和属性的列表,将它们中的大部分视为不安全的。
You can set the JAVA_TOOL_OPTIONSenvironment variable with described above debug switches instead of java control panel parameters before running JNLP file. (See http://www.oracle.com/technetwork/java/javase/envvars-138887.html#gbmsyand http://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#tooloptions). This is the correction of the previous Ivan' answer.
在运行 JNLP 文件之前,您可以使用上述调试开关而不是 java 控制面板参数设置JAVA_TOOL_OPTIONS环境变量。(参见http://www.oracle.com/technetwork/java/javase/envvars-138887.html#gbmsy和http://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#工具选项)。这是对之前伊万回答的更正。
For example, you can try the following batch-file which was tested for JDK 1.8.0_60:
例如,您可以尝试以下针对 JDK 1.8.0_60 测试过的批处理文件:
setlocal
set JAVAWS_TRACE_NATIVE=1
set JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,address=8002,server=y,suspend=n %JAVA_TOOL_OPTIONS%
set JAVA_HOME_64=c:\Java\jdk1.8
set JAVA_HOME=%JAVA_HOME_64%
set JDK_JRE_HOME=%JAVA_HOME%\jre
set JRE_HOME=%JDK_JRE_HOME%
set ONLINE_JNLP_URL=http://pont/dms/InstallDMS_debug.jnlp
"%JRE_HOME%\bin\javaws" %ONLINE_JNLP_URL%
endlocal
Additionally, I would like to notice that for remote debugging of Java WS-applications it is essential to run JDK's JRE but not public JRE, otherwise you can observe that JVM terminates before executing your main class.
此外,我想指出,对于 Java WS 应用程序的远程调试,必须运行 JDK 的 JRE 而不是公共 JRE,否则您可以观察到 JVM 在执行主类之前终止。
回答by Sbodd
Blatantly stealing Saeid Nourian's comment-answer:
公然窃取 Saeid Nourian 的评论-答案:
Add -Xdebug -agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=y
to the arguments in the Java Control Panel.
添加-Xdebug -agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=y
到 Java 控制面板中的参数。