Home > front end >  Getting set up with intelliJ IDEA
Getting set up with intelliJ IDEA

Time:10-10

Really basic question here but this has always stopped me from using any JetBrains product, but here I am trying once again. I also have the same issues with CLion but that will be for another time and hopefully I can figure it out based on some feedback from this post.

I need to set up my environment in IntelliJ. Nothing special. No build tools. Currently I just run my school projects using

javac Main.java
java Main

This has gotten me so far but I really want to use IntelliJ tools to their full capacity. I want to be able to set break points and step in and out of my code in their debugger and all the other nice tools that come with running my code through IntelliJ

Every get started tutorial that I have watched on YouTube or from JetBrains themselves already has a basic build configuration set up to run your basic "Hello World" application and that is what I think I need. Just compile my java files into classes and run/debug them.

This is what the run configuration icon in the IDE should look like

enter image description here

And this is what mine currently looks like

enter image description here

I have set many different JDKs to go along with my projects but none of them seem to get the tools I need set up in the IDE. I have even let IntelliJ download one for me and set it up itself to see if maybe I downloaded and installed it wrong and IntelliJ maybe wasn't recognizing it.

This picture below is showing the project structure for an application that I let IntelliJ download a JDK for and set it up itself

enter image description here

So if someone could help me that would be fantastic. Links to videos, blogs are welcome even though I know that isn't the convention on this forum but I think that would be sufficient for my situation. Thanks in advance!

CodePudding user response:

The easiest solution here would be to click the green play button next to your main method, on the left where line numbers are displayed.

Intellij will configure a default java run configuration for you. It will be displayed in the menu for later use, like in the screenshot you posted, after your first run.

You can also create one using the to menu: Run > Edit run configuration to add some more options like arguments, environment variables (that only apply for the run config), etc.

A good starting point would be the Intellij help page on that topic. This help pages are always a good start and you find comprehensible instructions there on every topic.

Another good resource is the Intellij by JetBrains YouTube channel. This video about debugging shows both ways I described above. They have lots of quick tutorials about lot of features, like code generation or build tools. Check out the channel's playlists for specific topics.

  • Related