Eclipse:启用断言 [英] Eclipse: enable assertions
问题描述
我正在运行Eclipse Galileo。如何在Eclipse中启用断言?
根据其他网站的建议,我已尝试添加参数: -ea
。我也尝试将编译器符合级别更改为 1.4
。这些建议都没有效果。
- 转到菜单
,然后再到菜单项
运行配置
。
-
在左面板中,转到
Java应用程序
,然后转到断言
>
-ea
以启用断言。
- 点击
Apply
,然后运行
按钮。
< hr>
将全局设置为默认值:
-
转到菜单
窗口
(如果您在Windows上)或转到菜单Eclipse
你在Mac)。对于Linux,它可能类似。 -
转到
首选项
。 >
-
从左侧选择
Java
,然后选择Installed JREs
面板。 -
选择您的 JRE ,然后单击
Edit ...
按钮。 -
在
默认VM参数
字段中,添加-ea
。
I'm running Eclipse Galileo. How do I enable assertions in Eclipse?
As suggested by other sites, I've tried adding the arguments: -ea
. I have also tried changing the compiler compliance level to 1.4
. Neither of those suggestions worked.
- Go to the menu
Run
, and then to the menu itemRun Configurations
.
In the left panel, go to
Java Application
, and then go toAssertions
.In the right panel, choose the tab
Arguments
.Under the field for
VM arguments
, type-ea
to enable assertions.
- Click on the
Apply
and thenRun
button.
To globally set it as the default for everything:
Go to menu
Window
(if you are on Windows), or go to menuEclipse
(if you are on Mac). For Linux it might be something similar.Go to
Preferences
.Choose
Java
, and thenInstalled JREs
from the left panel.Select your JRE, and then click the
Edit...
button in the right panel.In the
Default VM arguments
field, add-ea
.
这篇关于Eclipse:启用断言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!