Add Payara Server 5 to the Visual Studio Code Tutorial

Uncategorized

In this tutorial, I will explain how to add the Payara Server in the Visual Studio Code and deploy the maven web application to the Payara Server.

Prerequisite VSCode Extensions

Before going through this tutorial, you must install the following extensions from the Visual Studio Code marketplace:

You can install extensions from Extensions view (Ctrl + Shift + X) in the activity bar of VS Code:

extensions screen shot

Creating a Web Application

Maven is the most widely used project build and dependency management tool in the Java ecosystem. So in this tutorial we will generate a Maven Web Application through the Maven archetypes and deploy the application to the Payara Server. You may also follow the same deployment procedure for the Gradle projects.

Let’s start:

  • Open the command pallet using Ctrl + Shift + P, type Maven and select the Create Maven Project option:
maven project screen shot
  • Or in the explorer sidebar expand Maven Projects, Select the + sign to create a Maven Project:
maven project java overview screen shot
  • Select More… option to find archetype available in remote catalog:
more to find archetype catalog screen shot
  • Search for the javaee8-essentials-archetype or you may select any other archetype:
select archetype screen shot
  • Select the destination folder, where the project folder will be generated and answer the prompts (groupId, artifactId, version etc) in the focused TERMINAL window to setup the maven project.
  • Open the Maven project folder in VS Code via File menu -> Open Folder… and select the payara-sample project folder:
file menu screen shot
  • As you can see, the project has a basic structure with srcmainjava and srcmainwebapp folders where you will find a PingResource.java REST endpoint class to get started:
basic structure of project screen shot

Adding Payara Server

  • Open the command pallet using Ctrl + Shift + P, type Payara and select the Add Payara Server option:
add payara server screen shot
  • Or In the explorer sidebar (or Payara activity bar), expand Payara Servers, Select the + sign to add Payara Server:
expand and add payara server screen shot
  • Select the location of your ‘payara5‘ directory within the Payara Server installation:
Register Payara Server - Location
  • Now name the server whatever you want. For this example I’ve named it ‘Payara-Server-5.201‘. Press Enter:
Register Payara Server - Name

 

  • Finally, select a domain from the list or press the + sign to create the new domain:
Register Payara Server - Domain
  • The server is now created! You may also customize the JDK path or update the Admin Credentials by right click on the added server:
Payara Server - JDK Home
  • To start the Payara Server right click on the server in Payara Server explorer and select Start:
start payara server screen shot
  • After starting the server, you may see the server log in the OUTPUT window:
output window screen shot

Running the Payara Server Application

  • Now go to your project or rest endpoint file, right click on it and select the Run on Payara Server option. The project build will start and application will be deployed to Payara Server (Payara Server instance will be started if not running already):
run application on payara server
  • Now you should see a page (http://localhost:8080/payara-sample), eventually opened in your default browser. Enter the rest endpoint path to test the application.
test the application screenshot
  • You may also manage (undeploy/enable/disable) the deployed application by expanding the running Payara Server instance in the explorer sidebar and right click on the application:
undeploy the application
  • If you want to run custom goals, such as those inherited from Maven plugins, you can use the Maven Projects view in the explorer sidebar:
maven projects view in explorer sidebar

This is it! You now have a Visual Studio Code setup that is complete enough to handle any sort of real-world development.

Give it a try, download Payara Server

{{cta(‘6c4914a9-26de-4da5-b0fe-cd9f01ed1bea’)}}

New to Payara Server?  Follow the Getting Started Guides

{{cta(‘8336091b-a752-430c-bca6-4fa4bf2e8935’)}}{{cta(‘7a5cce4a-1c08-4a04-a259-3c85c1934c9d’)}}

 

Comments (17)

Post a comment

Your email address will not be published. Required fields are marked *

Payara needs the contact information you provide to us to contact you about our products and services. You may unsubscribe from these communications at any time. For information on how to unsubscribe, as well as our privacy practices and commitment to protecting your privacy, please review our Legal & Privacy Policy.

  1. Kiril Ivanov

    Hello. Sadly it wasn’t working for me as expected. I’m trying to run a project , but when I hit “Run on Payara Server”
    the only thing that is started is the Payara Server. No *.war files are created too.
    Same project working OK in netbeans ide.(but I preffer VS Code)
    I’m with latest maven 3.6.3, java 11 and all VS Code plugins updated.
    Thank you. Best Regards.

  2. Gaurav Gupta

    Hi Kiril,

    Thanks for trying out the Payara VSCode extension. May create an issue here: https://github.com/payara/ecosystem-vscode-plugin/issues
    and share you sample project to reproduce the issue, also please share the output console log.

    1. Kiril

      Hello.
      Basically, my problem is that when I click “Run on Payara Server”, only Payara started and NO *.war file/s are generated or deployed… just the Payara server started.

      Also I tried to manually create *.war with “mvn clean install”… and then I right click “Run on Payara Server” on the generated *.war file itself… payara and the project started successfuly and browser window pop-up with the index page of the project.

      Thank you again.

  3. Gaurav Gupta

    Hi Kiril,

    I request you to create the ticket on the GitHub and share more info:
    – Payara plugin also fires ‘mvn clean install’, can you share log from > Output window > select ${project-name} combobox.
    – OS detail
    – Pom of your project or sample project to reproduce.

  4. Artur Cordeiro

    Hi. I have exactly the same problem.

  5. Igor Vukovic

    Does it work with version 4

  6. Gaurav Gupta

    Hi Igor,

    Do you mean Payara 4.x? All Payara distributions are supported, make sure to use supported JDKs.

  7. sergej Woronkow

    Hey I created a payara server which I could start. But when I right click on the Project there is no “Run on Payara”… why is that missing

  8. Gaurav Gupta

    Hi Sergej,

    Thanks for using the Payara Vsocde tool. Did you opened multiple projects or a single project in the workspace? Can you try from *.java files, pom.xml, or src folder?

  9. Fadel AlHassan

    adding local payara server doesn’t work on ubuntu
    It stuck at choosing the domain

  10. Jadon Ortlepp

    Hi Fadel, can you please post your question with more info to https://groups.google.com/g/payara-forum – It will be easier to get help their with your issue.

  11. Anthony Shuba

    I too have tried to get my server added to VS code 1.50.1. I’ve added the Payara tools (0.0.4) along with Java Extension Pack, but the UI just gets stuck when choosing the domain. I get a dropdown list with my domain choices, but nothing is selectable. No errors – no nothing.

  12. Gaurav Gupta

    Hi Anthony,

    May check the error message in the VSCode Developer tool console (Help > Toggle Developer Tool > Console)?

  13. alexandre

    When I try to start my payara server, i get an error message saying :
    Error: Could not find or load main class Filespayara5glassfish.lib.grizzly-npn-api.jar
    Caused by: java.lang.ClassNotFoundException: Filespayara5glassfish.lib.grizzly-npn-api.jar

    I checked the presence of the said jar in the folder. What is the issue here ? Why can’t Payara load the main class file

  14. Gaurav Gupta

    Hi Alexandre,

    Is the same issue reproducible on starting the Payara Server from command-line, If yes please create the ticket here with environment details and reproducible steps: https://github.com/payara/payara/issues

    Otherwise If it’s only reproducible in VSCode then create the ticket here : https://github.com/payara/ecosystem-support/issues

    Thanks
    – Gaurav Gupta

  15. felipe Pino

    Encontré este repositorio en GitHub.. https://github.com/payara/ecosystem-support/issues/33 , además creo que el equipo de payara debería hacer un poco mas sobre este tema por favor……….

  16. Marc Bonet

    I cant beleive how this tutotial is still on-line having so many users reported the bug.
    Be able to deploy/debug a web-app with payara from within vscode is more than expected.
    Two years after, the bug is still open… ?
    I really want to work with payara but if we are not able to integrate in with out IDE we will be force to choose another option.

Related Posts

4 minutes
Uncategorized

Leading the Way: Payara Platform Community 7 Beta Now Fully Jakarta EE 11 Certified

We’re excited to announce that Payara Platform Community 7 Beta application server is now fully certified as Jakarta EE 11 […]

Understanding the Security Issues of Aging Middleware 8 minutes
Security

Understanding the Security Issues of Aging Middleware

Middleware runs quietly in the background of most applications, which makes it easy to overlook its lifecycle. In effect, […]

Blue background with coral and fish. Left text: 'MONTHLY CATCH'. Right: laptop screen with tech tabs and Payara Community logo. 4 minutes
Community

The Payara Monthly Catch – August 2025

Welcome aboard the August 2025 issue of The Payara Monthly Catch! With summer in full swing, things may have felt […]