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

前提是你 提交于 2020-01-06 05:30:14

问题


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.


回答1:


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

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.

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.



来源:https://stackoverflow.com/questions/44123913/how-to-enable-assertion-for-a-java-ee-project-in-netbeans

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!