I usually run a dual-monitor setup, so I have two Eclipse windows open for the same workspace, displaying different files. When I'm debugging and a breakpoint is hit, Eclipse switches to the "Debug" perspective, but it also shows the file/line where the breakpoint is in both of my windows. This occurs even if the file containing the breakpoint was open in one window but not the other (before the breakpoint was hit).
This is really annoying.
How can I have Eclipse only show the file containing the breakpoint in one window? Ideally, it would choose which window based on where the file is open already. If it's not already open somewhere, I don't really care which window it pops up in.
You can create another workspace and in that workspace create a new project from the same src code (same files in file system) of the one in your current project in your current workspace.
That would let you stop on one breakpoint without the other window stopping their too.
Notice that after you make some code modifications in one project you'd have to refresh the other project for those changes to apply in it.
Eclipse switches to the debug perspective for all windows the debug perspective has been opened once (i.e. the little icon on the right top corner is available). If you close that perspective (switch to another perspective is not sufficient), it won't switch to it anymore on that window.
At least, that's the behaviour I observed on Kepler (I know, that question is older but just came across, maybe it still helps someone).
This worked for me:
In Window->Preferences->Run/Debug->Launching->Launch Configurations enable "Apply window working set(s)"
Personally I find this more efficient than creating two workspaces.
Closing the Debug perspective (righ-click on the little icon on the right top corner) worked for me.
I'm using Oxygen and I have the following settings in the Run/Debug Preferences:
Open the associated perspective when launching: Never
Open the associated perspective when an application suspends: Prompt
Maybe you select the sources for Debugging by "File System Directory" instead of by "Java Project". To change this go to Run=>Debug Configuration=>Add Sources=Button: ADD...=>Java Project and select your Projects.
Make sure, that the added sources are found first by moving them to the top.
To disable multiple debugging in multiple windows in eclipse, go to Windows > Preferences > Run/Debug and uncheck Activate the debug view when a breakpoint is hit
Related
Intellij doesn't show run button even if that file is in src folder.
Maybe do you know what to do?
P. s. It's strange because that file used to show run button but after recloning git repository it just doesn't show any more.
Right click on src directory and select option Mark Directory As > Sources Root.
There is an Intellij bug that will result to an intermittent disappearance of that little tiny green run button on the left side of the source code (on same column where the red circle breakpoints are). Yes, you can right-click on the mouse and can do the run via the menu, BUT we love that tiny green button so bring it back!! From time to time, i see this green friend and then suddenly it vanish mysteriously and comes back again. I did all, such as rm -rf .idea and other weird stuff, but no explanation has ever been achieved to explain the vanishing green button and it's sudden re-appearance intermittently.
I am drafting this answer, because all of the above answers seems to claim that there is a logical explanation of the intermittent disappearance of our little green friend and that a sequence of steps exists to make our little green friend re-appear, when in fact, there is no such steps and we just have to accept this is a bug to save the remaining hairs in our scalp.
In my case Run/Debug buttons disappeared for all projects after updating from IDEA 2019.2 to 2019.3. Tried checking Sources Root, Invalidate Caches, Run/Debug configurations etc - no luck. Only restoring Run/Debug action group helped:
Right click on main toolbar (where the button disappeared) > Customize Menus and Toolbars... > select Run/Debug > Restore Run/Debug.
I got the same problem with intellij 2019.3 and 2020.1 and found the solution here : https://youtrack.jetbrains.com/issue/IDEA-228180.
Basically, in the IDE the buttons run/debug and the error detection in the code were missing.
The fix was to disable the plugin 'Gradle' (I don't need it anyway) :
Settings > Plugins > Gradle and click disable and apply.
After restarting your IDE it should work
I had this issue when building a microservice with SpringBoot.
I added a new microservice into the root folder and I could not run it.I am using Maven.
Step:
Open pom.xml
right click and select "Add as maven project"
It should resolve it immediately but you can reload the IDE if it does not update immediately.
IDE: Idea 2021.2.3
Build tool: Gradle
I removed the .idea and reimported the project from the Gradle source. Worked fine after.
Another reason could be the Highlighting Level set to None, it should be set at least to Syntax.
First, make the folder as source root.
Second, make sure you set the project’s sdk correctly. For example, if you set the sdk correctly then import java.util.Scanner can be analyzed by IDEA.
Tip:
try not setting the SDK to IDEA’s bundled JDK. I set the project’s SDK to JDK 11 bundled by IDEA at first then found it couldn’t resolve import java.util.Scanner. Setting to JDK 16 which is installed by the OS’s package manager solved this problem, then the “run” button showed up.
If IDEA can index a java file then the file icon will show with a small “c”, indicating a java class. If not, the file icon will show with a small “j”, as this problem’s image shows, indicating a java file which IDEA doesn’t index.
In my case there was a plugin (springboot helper) which I had to disable.
Reinstall the IDE, it solved my problem.
I also applied all these methods but it still didn't work so I stopped my window firewall and allowed access for this application. I don't know how it worked out for me but it just got displayed on top of my screen that window defender firewall has stopped some of this app's features and there was an option to allow so I clicked on it and it now works just fine.
I have to build a Decision Support System, but dont have much experience in Java. So after I connected to MySql with Eclipse (with Connector/J) eclipse started to mess up my other projects. Now, when i try to run other projects in eclipse (that are not related to MySql, ex. Guessing Game) the following error message apperars:
Launch configuration DocsConnectionPropsHelper references non-existing project MySql connection test.
Can anyone help me to resolve this problem please?
UPDATE. it seems that when i press "RUN" elcipse is not running the project that im working with, but other
Your update indicates the issue is actually running the wrong project. To avoid that you may want to close projects you're not working on (right click them in package explorer and select close).
If you do need multiple projects open then when clicking the run icon (which defaults to re-run whatever was ran last among your open projects) make sure you have open in the editor window something that can be ran (and is from the project you want to run).
Then click the drop down arrow to the right of the icon. This will open up a small menu with options to change your build configurations or how it should run your program (i.e. as an application or on a server).
To solve the problem:
-click right botton on the project package you want to work on (run)
-choose Run As
-choose Run Configurations...
-choose DocsConnectionPropsHelper - if in the Project box you see not correct title just remove it. Also remove anything what is in the Main Class box.
-click Apply
-the best option is to close Eclipse and reopen it to make sure that all the settings were configured
It worked for me. Hopefully it will work for you too.
usually when I debug java by pressing on the bug icon, it starts debugging right away and goes to the debug perspective...
but now everytime I click on the bug icon, it always opens up the debug configuration window rather than actually debugging....
any idea as to how to make it debug right away once again?
This usually happens if you have configured Eclipse to "Always launch the previously launched application" (Preferences>Run/Debug>Launching) but Eclipse can't find a previously launched application. Does this happen again if you configured the debug configuration once, debugged successfully with this configuration and then try to rerun it?
Or you could change this setting so Eclipse always tries to run/debug the currently opend file, then it will behave like Ed described it.
If it has a saved configuration for the currently active file in the editor, it will automatically use it. Otherwise, it will want you to tell it what you want. I'd suggest getting in the habit of using saved configurations (down-arrow on the debug button) that you've set up.
You could install 'Eclipse Runner' via marketplace. It's a nice addition of run/debug feature.
I faced the same problem. I defined the debug configuration and run my Junit but my eclipse was crashing again and again.
I restarted my eclipse and my debugAs menu is back to two options [Debug on server or debug as Junit].
Hope it might help.
When compiling android stuff in eclipse, I am forever annoyed when I hit the "Run" button to compile and run, if I am in a .java file everything works great if im in an .xml file (for android layouts) it compiles the xml file and produces an _out.xml file which screws up the project so that I first have to delete the "out" file then clean my project files.
Any quick answer on how to disable the compiling of xml files?
Samuel has told already a solution. What I prefer is to use the "always run the last project" setting.
Go to window -> preferences -> Run/Debug -> Launching and than activate the option on the bottom labeled: "Always launch the previously launched application"
If you have multiple projects you will sometimes have the issue that you start a project you didn't meant to start. That will occur only once, because after starting the right project, you will stick to that until you switch to the next project (which shouldn't happen very often on a working day).
Its not a perfect solution, but prevents the mentioned issue with, in my experience, the lowest/smallest (whats the right term?) side effects.
There is no way to do this, the reason it happens is because of the fact that when you click "run" it's trying to run the .xml instead of the Project its-self. The easiest thing to do to avoid this, is when you go to hit run do a Ctrl+s, then click on the project folder, then hit run, or do the same thing, but switch tab to a .java file. Sorry to be the bearer or bad news, when I started I had the same problem.. drove me crazy, but when you get into the new habit, you're just fine!
I have recently been setting up SVN in Eclipse using the Subversive plugin (I am still a bit lost, but that's another issue).
I have been using this guide (http://soledadpenades.com/2008/12/10/add-svn-support-to-your-eclipse-installation/) and finally got it working!
The only problem now is, I can't seem to find the Package Explorer, which is the only explorer I could ever seem to get working how I wanted it to (grouping projects into working sets).
Normally, you get it from going to Window → Show View → Other, and then select it from the list. The only thing is, it's not IN the list of views... leaving me rather confused.
Just to be clear, I was using the package explorer before with no problems. I am running the latest version of everything as I did the auto update.
Any suggestions as to what is wrong here?
I'm guessing you've made it a fast view or minimised it to it. You could try holding down Ctrl + F7 to see a list of all views, then up/down arrow to the View. If Package Explorer is in the list it has been minimised or something.
If you select it and still can't see it, try Window → Reset Perspective... to restore all views to their defaults.
Alt+Shift+Q worked for me when I was in debug mode.
Weirdly enough, although reset perspective didn't work, menu Window → New window worked! It opened a new window with the perspectives reset.
For me I needed to do two things:
Reinstall the "Eclipse Java development tools" via Help → Install Software → Programming Languages
Delete and recreate the .metadata Eclipse Workspace settings.
Honestly, deleting the .metadata directory is probably sufficient - try that first.
At the top right corner, there is a button called Open Perspective. Click on it, and then Java Default. Everything will come back to normal.
Are you sure you are in the Java perspective?
As views are related to perspectives this could be the problem. The current perspective can be found in the upper right corner.
You may be missing the JDT plugin containing the Package Explorer.
I think you were actually still in the Debug perspective, since that was what did it for me. As someone mentioned above, I had to go to the top right and hit "Java perspective" to get back to my normal views.
Three answerers were helpful, however the only cure was to reinstall Eclipse and install the plugins again. Weird problem, and the exact cause not found. I may have deleted some files somehow, but a reinstall solved it.
On the right top you can select Java or JRE or whatever. That button might got changed. So click the neighbor buttons such as Java or something.
Go to Window -> perspective -> Open Perspective -> Java. Now all the packages in Java will be displayed in the package explorer.