[英]Remote debugging java web start under JVM 1.8
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. 但是在安装JDK 1.8之后,它都停止了工作,我的javaws没有看到任何额外的X || D参数。 I tried this way:
我试过这种方式:
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控制面板设置params,将它们直接添加到JVM。
Control Panel > Java > Java (tab) > View (button) > Runtime parameters (field)
How can I set params for 1.8 good old way? 如何为1.8岁的方式设置参数?
PS JDK 1.6 x32 still works well with shortcuts. PS JDK 1.6 x32仍适用于快捷方式。 x64 1.7 starts but references to 1.8 libs, so I think all JDK x64 are in collusion.
x64 1.7启动但引用1.8库,所以我认为所有JDK x64都是串通的。
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_OPTIONS environment variable with described above debug switches instead of java control panel parameters before running JNLP file. 在运行JNLP文件之前,可以使用上述调试开关而不是java控制面板参数设置JAVA_TOOL_OPTIONS环境变量。 (See http://www.oracle.com/technetwork/java/javase/envvars-138887.html#gbmsy and http://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#tooloptions ).
(参见http://www.oracle.com/technetwork/java/javase/envvars-138887.html#gbmsy和http://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#工具选项 )。 This is the correction of the previous Ivan' answer.
这是前一个伊万回答的修正。
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\64\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在执行主类之前终止。
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控制面板中的参数。
After all it still works with 毕竟它仍然适用
set JAVA_TOOLS=-agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=y
in bat file. 在bat文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.