Remote debugging java web start under JVM 1.8

后端 未结 3 979
我寻月下人不归
我寻月下人不归 2020-12-06 11:32

I have a Java Web Start application, which I used to start through a shortcut:

\"C:\\Program Files\\Java\\jdk1.7.0_67\\bin\\javaws.exe\" -J-Dfile.encoding=UT         


        
相关标签:
3条回答
  • 2020-12-06 11:36

    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.

    You can set the JAVA_TOOL_OPTIONS environment 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#gbmsy and http://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#tooloptions). 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:

    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.

    0 讨论(0)
  • 2020-12-06 11:56

    Blatantly stealing Saeid Nourian's comment-answer:

    Add -Xdebug -agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=y to the arguments in the Java Control Panel.

    0 讨论(0)
  • 2020-12-06 11:58

    After all it still works with

    set JAVA_TOOLS=-agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=y
    

    in bat file.

    0 讨论(0)
提交回复
热议问题