简体   繁体   中英

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. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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