IntelliJ: Debug Your Plugin

May 14, 2017
IntelliJ: Debug Your Plugin
  • IntelliJ: Debug your Plugin

    Guide to remote debugging with IntelliJ IDEA.



    Thought I'd make a tutorial on how to remote debug using IntelliJ since there are no detailed, recent examples or tutorials. In this tutorial I will be using IntelliJ IDEA 15, however the process should be similar for other versions of the IDE. Please note this tutorial will work with both Windows and Mac OS X.

    Requirements:
    Stopped Server
    IntelliJ IDEA
    Project to Test/Use With
    < 3 Minutes

    Step 1 | Setting Up IntelliJ

    • Navigate to Run > Edit Configurations

    [​IMG]

    • You should now see the window below, click + (top left) > Remote

    [​IMG]

    • You have created a new configuration! Now we need to set it up. Give it a name, set the port (I've used 5005) and copy the text from the top text box (you can see I have highlighted it below) we will be using it to setup the server. Hit Apply > Ok to save and close this window.

    [​IMG]

    Step 2 | Editing the Server Startup Command

    • Now we need to add the arguments to the startup script. Open the start_server.command or start_server.bat and paste the following arguments before the '-jar spigot.jar' on the same line. We have just copied these from the Edit Configurations window in the previous step.

    Code (Text):
    -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
    • This is how mine looked after the addition, yours should looks similar.

    Code (Text):
    java -Xmx2G -Xms2G -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar ./spigot.jar
    • Save the file and start your server. When it has loaded up fully move onto the next step.

    Step 3 | Connecting IntelliJ and Compiling

    • Take a look in the top right hand corner of IntelliJ and you should see the name of the new configuration you have just made, and a few buttons like as pictured.
    [​IMG]

    (NB. If your config isn't selected, please select it from the dropdown)
    • Hit the green Bug button to connect, the following console will popup in the bottom corner of your screen and show you whether if it has been successful.
    [​IMG]

    • Thats it! You are now connected, all you have to do is press the button to the left of the configuration name (pictured in the first picture of this step, highlighted with red square) to make and reload the project including your changes.
    • The first time you do this, a message box pops up asking you to confirm you want to make the changes. It will be easiest if you tick 'Don't show this message again' to speed the process up.
    I hope you find this as useful as I do. If you need help make a post on the forum and if I see it i will try to help you out,

    - xtechgamer735
  • Loading...
  • Loading...