Eclipse:启用断言 [英] Eclipse: enable assertions

查看:133
本文介绍了Eclipse:启用断言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Eclipse Galileo。如何在Eclipse中启用断言?



根据其他网站的建议,我已尝试添加参数: -ea 。我也尝试将编译器符合级别更改为 1.4 。这些建议都没有效果。

解决方案


  1. 转到菜单 ,然后再到菜单项 运行配置


  1. 左面板中,转到 Java应用程序,然后转到断言

    > ,请键入 -ea 以启用断言。



  1. 点击 Apply ,然后运行 按钮。



< hr>

将全局设置为默认值


  1. 转到菜单窗口(如果您在Windows上)或转到菜单 Eclipse 你在Mac)。对于Linux,它可能类似。


  2. 转到首选项。 >

  3. 左侧选择 Java ,然后选择 Installed JREs 面板


  4. 选择您的 JRE ,然后单击 Edit ... 按钮。


  5. 默认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.

解决方案

  1. Go to the menu Run, and then to the menu item Run Configurations.

  1. In the left panel, go to Java Application, and then go to Assertions.

  2. In the right panel, choose the tab Arguments.

  3. Under the field for VM arguments, type -ea to enable assertions.

  1. Click on the Apply and then Run button.


To globally set it as the default for everything:

  1. Go to menu Window (if you are on Windows), or go to menu Eclipse (if you are on Mac). For Linux it might be something similar.

  2. Go to Preferences.

  3. Choose Java, and then Installed JREs from the left panel.

  4. Select your JRE, and then click the Edit... button in the right panel.

  5. In the Default VM arguments field, add -ea.

这篇关于Eclipse:启用断言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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