问题
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