So I’ve been doing all of my Java practice problems without any help from a debugger… like at all. It would have been great to have, but I’ve been getting by without it. Tonight, with some help, I finally have debugger working on these Exercism projects. Before I forget what I did, I’ll be documenting the process.
First thing’s first, you need to go in and define the
Project Compiler Path, which is going to be needed once we start debugging. In order to do the debugging, the files get built and they get shoved into that directory. So make sure you create one for the project. To get here, hit cmd + ;, or go to File -> Project structure. This setting will be on the bottom of the project tab.
Once that’s done click on the modules tab. You’ll now need to go and set the
/src/main/java to be a source folder, and then
/src/test/java to a test folder. These must be set for this to work.
After the test folder has been set, open up the specific test file. Most likely the screen is going to be freaking out and telling you that it can’t run anything. You need to get a version of JUnit. Click on one of the import statements for JUnit (ON the word
JUnit) and hit alt + enter. You should have the option to download JUnit 4 or something like it. Hit enter on it and allow it to install.
After that has been installed, you should now see a bunch of play buttons all over the test file. You can finally start the tests straight from here! And, better yet, swap over to the main file and set your break points.
You’re good to go with debugging now!