简体   繁体   English

如何在NetBeans中为Java EE项目启用断言?

[英]How to enable assertion for a Java EE project in NetBeans?

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. 我希望为在Payara 4.1.1.172上运行并从NetBeans 8.2内部署的Java EE代码启用Java断言。 I tried to specify exec.args=-ea in the NetBeans Action "Debug project", but that doesn't help. 我试图在NetBeans Action“调试项目”中指定exec.args=-ea ,但这无济于事。 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. https://stackoverflow.com/a/14710564/1797006建议在服务器设置中配置JVM选项,但由于NetBeans 8.2或Glassfish服务器布局,这些选项不可用。

You need to modify the settings in the Payara Server configuration, because Netbeans only deploys an application to an already running server. 您需要修改Payara Server配置中的设置,因为Netbeans仅将应用程序部署到已经运行的服务器上。

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. 您可以从管理控制台执行此操作,可以从Netbeans中打开它-右键单击“服务”窗口中的Payara服务器,然后选择“查看域管理控制台”。

Then, the Admin console should open in a browser (if it doesn't just point your browser to http://localhost:4848 ). 然后,管理控制台应在浏览器中打开(如果它不只是将浏览器指向http:// localhost:4848 )。 Go to Configuration -> server-config -> JVM settings -> JVM options tab. 转到配置->服务器配置-> JVM设置-> JVM选项选项卡。 Then press the button "Add JVM Option" and specify -ea as its value 然后按下按钮“添加JVM选项”并指定-ea作为其值

You need to restart the server afterwards. 之后,您需要重新启动服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM