GlassFish Server in VS Code

To set up GlassFish Server in Visual Studio Code, follow these steps:

Setup Java support in Visual Studio Code

Add GlassFish Server to VS Code

  • In VS Code, set up the Community Server Connectors extension, which provides a plugin for GlassFish
  • Then open the Explorer sidebar
  • Click on the SERVERS section
  • Right-click on Community Server Connector, and select the Create New Server… option
  • Then either choose to download and install GlassFish 7, or to use an existing GlassFish Server installation (download GlassFish here)

Run your application with GlassFish

  • In Visual Studio Code, open the directory that contains your project. Visual Studio Code will do the rest for you, it will automatically configure your project. Proceed with clean/building the application (e.g. using the Maven or Gradle panel in VS Code sidebar).
  • After your project is built, right-click the generated WAR file under the target directory (Maven project) or in the build directory (Gradle project), select “Run on Server”, and select GlassFish (select No for Edit deployment parameters when asked).
  • To open the application in the browser:
    • Open the Explorer sidebar in VS Code
    • In the SERVERS section, right click on GlassFish and select Server Actions…