How can I debug applications under Java Web Start (JNLP)?

前端 未结 9 2238
你的背包
你的背包 2020-11-29 02:29

I know how I can debug a remote Java VM with Eclipse, but how can I do it with a Java Web Start program. I have a problem that only occurs in Java Web Start. It must be secu

相关标签:
9条回答
  • 2020-11-29 03:26

    As for newer versions of Java (Java 8u20+ and Java 7u70+) i experienced that parameters like -Xrunjdwp cannot be passed directly nor using JAVAWS_VM_ARGS. Message Rejecting attempt to specify insecure property: -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 started to show up in console output.

    The only solution that worked for me was to pass those arguments into JAVA_TOOL_OPTIONS system variable.

    0 讨论(0)
  • 2020-11-29 03:31

    To debug a Web Start application in Linux, create a shell script ~/bin/javaws-debug.sh with the javaws invocation in debug mode as described above:

    ~/bin/javaws-debug.sh:

    #!/bin/sh
    export JAVAWS_TRACE_NATIVE=1
    export JAVAWS_VM_ARGS="-Xdebug -Xnoagent -Djava.compiler=NONE 
      -Xrunjdwp:transport=dt_socket,address=8989,server=y,suspend=n"
    javaws "$@"
    

    Then, in your browser, choose that script as the application to invoke on jnlp files.

    For example, in Firefox, go to Edit→Preferences→Applications, Content Type: Java Web Start, and choose "Use Other" in Action and pick the script from the "Select Helper Application" dialog. In Chrome, you need to alter Linux system settings. In KDE, go to System Settings→File Associations, Known Types: application:x-java-jnlp-file, add a new Application, pick ~/bin/javaws-debug.sh from the "Choose Application for application/x-java-jnlp-file" dialog.

    Once your browser is configured, Java Web Start application will start using your wrapper, which will enable debugger to connect on port 8989.

    0 讨论(0)
  • 2020-11-29 03:35

    With Java 8 and Windows 10, open command prompt (cmd.exe) and type this:

    set JAVAWS_TRACE_NATIVE=1
    set JAVA_TOOL_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
    javaws java-app.jnlp
    
    0 讨论(0)
提交回复
热议问题