I started developing a game in Java with Eclipse. As you all know you have to debug a lot while coding. But I have the following issue:

My game is full-screen. If I run into a breakpoint it stops (like it should) and for some reason I can't switch window anymore (I am using Windows 7). I have to press Ctrl + Alt + Delete" and start the "Task manager" to be able to switch to Eclipse window and continue debugging.

So I tried to use window mode instead of full screen. Now if I run into a breakpoint the Eclipse window gets the focus (automatically) and I can debug easily.

So I thought it would be great to be in window mode, if and only if I am in debug mode, else it should be full screen.

For this I need to know if I am in debug mode or not. After reading this and this it seems like you can't check that easily, cause it depends on the VM you are using. Also it seems like the best solution is to use the Eclipse Debug/Run-Configuration and set a VM or program argument.

But how can I tell Eclipse to use this configuration only for debug mode? Or is there even a better way to determine, if debug is on or off?

有帮助吗?

解决方案

It seems like the best way is to use arguments and pass them by using a Debug-Configuration and a Run-Configuration with the right values.

In Eclipse you have the possibility to add a Configuration to the Run list and the Debug list.
This can be done by going to the common tab inside the configurations and check the Debug and/or Run checkbox inside the "Display in favorite menu" section.
You can also edit the favorite list (add/remove/move entries) by clicking "Organize Favorites".

Note, that it does not prevent you from runing the Debug-Configuration or debuging the Run-Configuration.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top