GlassFish Server in Netbeans IDE

The Netbeans IDE distribution for Java EE / Jakarta EE supports GlassFish Server out of the box.

How to add GlassFish server

To run applications on GlassFish from within Netbeans, you must register your GlassFish Server installation as a NetBeans server instance. Follow these instructions to register the GlassFish Server in NetBeans IDE.

  1. From the Tools menu, select Servers.
  2. In the Servers dialog, click Add Server.
  3. Under Choose Server, select GlassFish Server and click Next.
  4. Under Server Location, browse to or enter the location of your GlassFish Server installation.
  5. Click Next.
  6. Under Domain Location, select the default domain, domain1.
  7. Click Finish.

Then you can just run your application and select GlassFish as the server to run it – Right-click on your project in the Project or Package explorer, select Run, and then select the GlassFish server you added with the above steps. After your application is started successfully, Netbeans should open a web browser with the URL that should point to your application.

Here are similar instructions with pictures: https://stackoverflow.com/a/58083919/784594

Create and run an application

To create a web application in Netbeans and run it on GlassFish, you can follow this Netbeans tutorial: Getting Started with Java EE Applications