Sorry for the strange name of my question. I don't know how to look for this because I don't know how these things are called.
There's a features in Visual Studio at least where you can click on the left of the code and set a starting point which is a big red dot. Then you run the program and you can trace the steps by pressing f8 or f5 (different f's really) and you see the variable values on each step etc. I find it extremely useful because I can see where an error occurs and how the program behaves.
I have no idea what this is called and I want to ask is there such a thing in NetBeans IDE 8.0.2 or jGrasp or any java compiler?
Sorry if anything sounds stupid, I'm kind of a newbie. Thank you all
Most IDEs have debugging functionality built in.
In Netbeans, you can easily add/remove a break point by simply clicking the line number on right side of the source editor (you can also do via the editor popup menu)
You start the debugger through F5 (ShiftF5 for debug the current file) or via the debug icon on the toolbar
You can use F8 to step over the command/method call, F7 to step into a method. You can resume running the program using F5 while the debugger is running.
See Debugger and Profiler and Using the Visual Debugger in NetBeans IDE for more details
Finding how to do this in your IDE is pretty easy, see the other answers.
What is a bit more difficult is debugging an external (and/or) remote Java program in your IDE. Here it is how to do that with Eclipse: http://www.ibm.com/developerworks/library/os-eclipse-javadebug/. I guess other IDEs are similar. If you test via Maven/Surefire, you have a simple flag to do the same: http://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html