How to remove default command line arguments provided by Eclipse?
To make a long story short, I found out that I must start my java applications without "-XstartOnFirstThread". However, Eclipse provides this argument to any java application started via Eclipse开发者_StackOverflow中文版 (see Properties of the running application in debug-mode).
I can't see where these default arguments come from and how I can adjust or remove them. The argument fields in the "Run Configurations" are empty and the fields for the default arguments for my current JRE are empty as well (can be found via Properties -> Java -> Installed JREs -> Edit).
Any help would be appreciated!
The long story: I got the error *** __NSAutoreleaseNoPool(): Object 0x100166860 of class NSConcreteMapTableValueEnumerator autoreleased with no pool in place - just leaking
when starting a Swing-based application with nearly no logic. I knew that the application runs fine under Windows and Linux, so it was not an error in the code.
I had no problem with an error showing up, since the application started nontheless. However, I couldn't interact with the window. That means I couldn't focus on it (it moved to background automatically when I brought it into focus) and I couldn't click any buttons or menus.
After an hour digging around the web I found out that:
- this is a problem with SWT and AWT running at the same time (AWT will hang to load if SWT is loaded)
- this problem only occurs when starting from eclipse, starting the application via the console (without arguments) everything runs fine
- this problem occurs when the wrong thread is used (the mentioned
-XstartOnFirstThread
and-XstartOnSecondThread
arguments)
Now I am near my goal, since I know that I have to replace -XstartOnFirstThread
with -XstartOnSecondThread
(tested from the console -- application runs fine on the second thread and throws the posted error on the first thread). Now I only need to know how to remove the default argument, which is provided to any java application started via Eclipse.
Thanks again!
EDIT: Like mentioned the problem occurs due to the -XstartOnFirstThread
argument. However the solution was not to remove that argument (impossible, see accepted answer): The solution is to remove swt.jar
from the classpath.
This is due to the fact that Eclipse appends this argument when swt.jar
is in the classpath. Loading the library leads to the described problems, even though it is not used.
This is a unresolved eclipse Bug: Bug 211625 - Need option to omit -XstartOnFirstThread for
Also have a look at this 'workaround'.
精彩评论