How to enable assertion for a Java EE project in N

2019-09-17 08:22发布

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条回答
贼婆χ
2楼-- · 2019-09-17 08:49

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.

查看更多
登录 后发表回答