如何删除Eclipse提供的默认命令行参数? [英] How to remove default command line arguments provided by Eclipse?

查看:109
本文介绍了如何删除Eclipse提供的默认命令行参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

长话短说,我发现我必须在没有 -XstartOnFirstThread的情况下启动我的Java应用程序。但是,Eclipse向通过Eclipse启动的任何Java应用程序都提供了此参数(请参阅以调试方式运行的应用程序的属性)。

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 (see Properties of the running application in debug-mode).

我看不到这些默认参数在哪里来自以及如何调整或删除它们。 运行配置中的参数字段为空,而当前JRE的默认参数的字段也为空(可以通过属性-> Java->已安装的JRE->编辑找到)。

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).

任何帮助将不胜感激!

长话大说:我遇到了错误 *** __NSAutoreleaseNoPool():类NSConcreteMapTableValueEnumerator的对象0x100166860在没有池的情况下自动释放-在几乎没有逻辑的情况下启动基于Swing的应用程序时只是泄漏。我知道该应用程序可以在Windows和Linux上正常运行,因此这不是代码中的错误。

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:


  • 这是SWT和AWT同时运行的问题(AWT会挂在如果加载了SWT,则加载)

  • 仅当从eclipse启动,通过控制台启动应用程序(不带参数)时,才会出现此问题

  • 使用错误的线程(提到的 -XstartOnFirstThread -XstartOnSecondThread 参数)时会发生此问题

  • 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)

现在,我已经接近目标了,因为我知道必须将 -XstartOnFirstThread 替换为 -XstartOnSecondThread (从控制台进行了测试-应用程序在第二个线程上运行良好,并在第一个线程上引发了发布的错误)。现在,我只需要知道如何删除默认参数,该默认参数将提供给通过Eclipse启动的任何Java应用程序。

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.

再次感谢!

编辑:如前所述,该问题是由于 -XstartOnFirstThread 参数引起的。但是,解决方案不是删除该参数(不可能,请参见接受的答案):解决方案是从类路径中删除 swt.jar

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.

这是由于当 swt.jar 在类路径中时,Eclipse会附加此参数。即使不使用库,加载库也会导致所描述的问题。

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.

推荐答案

这是一个未解决的月食Bug:错误211625-需要选项以省略-XstartOnFirstThread

This is a unresolved eclipse Bug: Bug 211625 - Need option to omit -XstartOnFirstThread for

也请查看此解决方法

这篇关于如何删除Eclipse提供的默认命令行参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆