如何在NetBeans中为Java EE项目启用断言? [英] How to enable assertion for a Java EE project in NetBeans?

查看:180
本文介绍了如何在NetBeans中为Java EE项目启用断言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望对运行在Payara 4.1.1.172上并从NetBeans 8.2内部署的Java EE代码启用Java断言.我试图在NetBeans Action调试项目"中指定exec.args=-ea,但这无济于事. https://stackoverflow.com/a/14710564/1797006 建议在服务器设置中配置JVM选项,但是那些由于NetBeans 8.2或Glassfish服务器布局而无法使用.

I'd like Java assertions to be enabled for Java EE code which is running on Payara 4.1.1.172 and is deployed from within NetBeans 8.2. I tried to specify exec.args=-ea in the NetBeans Action "Debug project", but that doesn't help. https://stackoverflow.com/a/14710564/1797006 suggests to configure the JVM options in the server settings, but those aren't available because of NetBeans 8.2 or the Glassfish server layout.

推荐答案

您需要修改Payara Server配置中的设置,因为Netbeans仅将应用程序部署到已经运行的服务器上.

You need to modify the settings in the Payara Server configuration, because Netbeans only deploys an application to an already running server.

您可以在管理控制台中执行此操作,可以从Netbeans中打开它-右键单击服务"窗口中的Payara服务器,然后选择查看域管理控制台".

You can do this from the Admin Console, which you can open from Netbeans - right click on the Payara Server in the Services window and select View Domain Admin Console.

然后,管理控制台应在浏览器中打开(如果它不只是将浏览器指向 http://localhost: 4848 ). 转到配置->服务器配置-> JVM设置-> JVM选项选项卡.然后按下按钮添加JVM选项",并指定-ea作为其值

Then, the Admin console should open in a browser (if it doesn't just point your browser to http://localhost:4848). Go to Configuration -> server-config -> JVM settings -> JVM options tab. Then press the button "Add JVM Option" and specify -ea as its value

您需要随后重新启动服务器.

You need to restart the server afterwards.

这篇关于如何在NetBeans中为Java EE项目启用断言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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