Why isn't my project going into debug mode? - java

Hi i'm new to java and when I press the debug button it is not going into debug mode.
After clicking on the drop down arrow next to the icon it says 1 new configuration and when that launches it just says in the console 'OK'. If I go on debug as it just says none applicable.
If I go on debug configurations I don't really understand what I'm supposed to go on to get it into debug mode as i guess it is something to do with the configuration?
If it helps I'm trying to write code for a project, not android or anything like that. Hope this is enough information, thanks.

Did you remember to add a breakpoint somewhere? If not, add a breakpoint! You can do that by double clicking one of the line numbers in your source code.
You may also want to check the toolbar to see if you accidentally checked the "skip all breakpoints" option.

Related

Intellij Debugging - Why is step in/step out greyed out?

This is what I see in my Intellij UI IDE
The correct breakpoint is being hit(line 128 - checkRunFlag() )
but the step over/step in buttons next to console in the bottom left part of the screen are greyed out. Does anyone know what is causing this/how I can re-enable those buttons?
In my case it was greyed out until i entered a input (i.e part of program before breakpoint). After i entered the input using Scanner class, i was able to access step into and other buttons.
change to your debug application
I'm still not sure what the cause of this issue was but what I did to fix the issue was call kill -9 with the process id of Intellij
Then I restarted Intellij and it's working fine now
you can click the "pause pragram" to see where the breakpoints stopped. then make sure it's your expect application.

Eclipse Terminate context menu entry greyed out

Before asking - I have checked similar questions and was not able to achieve my goal so far. My trouble resulted from CTRL+F2 not working in Eclipse. Therefore I spent time looking for shortcut settings and tested solutions here
What is the short cut in eclipse to terminate debugging/running?
or here
Eclipse Terminate Keyboard Shortcut
yet none of this seems to work.
By now I have discovered the reason why, so here is the question:
Why is my context menu Run > Terminate greyed out, even though a Java application is launched?
The steps I am taking are:
1) ALT+R to open Run context menu
2) N to open Run Configurations
3) ALT+R to run my configuration
4) The application launches as expected
5) Now I switch back to Eclipse and press ALT+R again - Terminate is greyed out, while the application is running.
Why is that?
Note:
This is the reason for the terminate shortcut not working properly, because this context menu entry is annotated with the according shortcut, as long as it is greyed out nothing will ever happen.
I am also in the Debug perspective.
Pressing the red rectangled Stop UI element will still kill the application, as it should. All the while the context menu entry in Run remains greyed out. Why would these two even map to different things?
Thanks in advance for any kind of insight.
This is only enabled when you have selected the application in the Debug view.
I was able to achieve what I was looking for with help of #greg-449.
The setup is now as follows:
In Eclipse open Window > Preferences > General > Keys > Show View (Debug) set a shortcut to ALT+ SHIFT + F2 as suggested in the sources I linked. Set binding to In Windows.
Now after launching it is possible to press the newly set shortcut to open debug and after that the Terminate context menu will become available, even though there is apparently no way to call Terminate all which is what the UI element does.
In conclusion, it is complicated, but at least it works. Being forced to manage launches this way still seems absurd to me, however.

Unable to debug using eclipse debugger

So there is a small java program to add two numbers.
There is one break-point.
I used Debug as -> Java Application.
But still, Step Into, Step Over, Resume, Suspend and Terminate buttons are disabled in my eclipse.
See below:
Debugger recognized the breakpoint at int b = 3 but still the buttons are disabled.
Everything was working fine yesterday.
What should be the cause?
Possibles solutions and cause here.
The commands got disabled, probably from previous customization, (check General -> Keys) but I wouldn't think this can be the only reason to be cause of this issue.
Hope this helps you out.
I have met the same issue and fixed it. The following are the possible solutions:
Make sure that your skip all break point option is disabled
Reset your debug perspective in perspective options.
Make sure to restart eclipse after doing above things

Log message/error at design-time in IntelliJ Idea?

I have had a problem with a custom component I am writing. The issue seems to be a resource not loading properly (not sure why) at design-time.
To track it down I'd like to put in some debug-code that will execute at design-time, and give output in form of some messages.
Is there a log or something similar that can be written to at design-time?
Thanks
There's a really nice trick you can use to add debug statements in IntelliJ without actually changing the code. The answer is to use non-suspending breakpoints.
Add a breakpoint at the necessary point in the code, then right click on it. De-select "Suspend", and then put whatever you want in the "Log evaluated expression" - this will give you access to the fields of the instance.
Run your app in debug mode, and you'll get debugging info in the console without having to manually examine everything.

how to track System.out.println in debug mode in complete project

There is a project, that I am working on. I am new to that project. Problem is when I click on submit button on certain JSP page, it prints something on console. What ever printed is definitely inside System.out.println(). But I am unable to track that SOP. I also searched that piece of value through search tool in eclipse. But I couldn't find it. Is there any way to do that in debug mode, means can I add breakpoint to my whole project. Guide me. I am stuck.
Logging is a better way to track SOP kind of things. Use the Log class to log info about the the app, it's got Debug, Verbose, Info, Warning and other stuff

Categories