There's no direct support for Payara Micro in Netbeans to run web applications yet.
The simplest solution is to open the build.xml
configuration file and insert the followin snippet right below the line with the import
statement:
<target name="-run-deploy-nb"/>
<target name="run" depends="run-deploy">
<java jar="/path/to/payara-micro.jar">
<jvmarg value="-Xmx256m">
<arg value="--deploy"/>
<arg value="${dist.war}"/>
<arg value="--port"/>
<arg value="8080"/>
<arg value="--autobindhttp"/>
</java>
</target>
Instead of /path/to/payara-micro.jar
specify absolute path to your payara-micro.jar
, or if payara-micro.jar
is inside your project dir in a lib
directory, you may specify the relative path with the basedir
variable like this:
<java jar="${basedir}/lib/payara-micro.jar">
After you save the build.xml
file, you can press F6 and your application will be deployed with Payara Micro. You should then configure command line parameters in build.xml
instead of your Run
Java class (you should delete your Run
class because it won't be used)
Edit:
If you want to restart (redeploy) your application, you have to press Ctrl + Shift + Del to stop the running application before pressing F6 to run the new version. So each time you want to redeploy, first press Ctrl + Shift + Del and then F6.