Eclipse: Debug your Plugin

Oct 22, 2019
Eclipse: Debug your Plugin
  • Eclipse: Debug your Plugin

    Easy remote debugging with Eclipse

    Add Debugging statement to server script(top)

    Add following statement to your server start script:
    Code (Text):
    -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005

    The statements have to be inserted between java and -jar statement! This is important.

    So it should looks like:
    Code (Bash):
    @echo off
    java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -Xms512M -Xmx1024M -XX:MaxPermSize=128M -jar spigot.jar

    Open Debug Configuration in Eclipse(top)

    Click on the arrow next to the "Debug" button and select Debug Configurations...

    Remote Debug Configuration(top)

    Click on Remote Java Application and press the Add button on the top.

    On the right side you now see the debug configuration. Name your configuration and type 5005 in the Port textfield.
    Click Apply and Close.

    Note: You can change the port by editing the start script statement and the debug configuration.

    Restart your server(top)

    With restarting your server the "debug server" will be started on port 5005.

    Set breakpoint and debug(top)

    After that your are able to debug your plugin! Just set a breakpoint in the code, press Debug (your server has to be running) and select the new created Debug configuration in Eclipse. Now start minecraft, join your server and play! When you hit the breakpoint you will see the debug view in Eclipse.

    Careful: You have to set max-tick-time to a very high value (eg. 60000000) in your server config [spigot.yml]. So the server won't close after a short time at debugging.

    The user will be kicked out of the game really fast, because of a timeout! So you have to remember that!

    Thanks for reading ;) And start debug your Plugin.

    IMPORTANT: The default value of timeout-time in spigot.yml is 60. This causes your server to time out if you resume the thread after 60 seconds. To prevent your server from constantly timing out while debugging, set timeout-time to a large number.

    The client will still time out after 30 seconds, so if someone knows how to overcome this please edit this wiki!
  • Loading...
  • Loading...