Installing Payara Server on Mac

Uncategorized

Introduction

This blog explains the setup of Payara Server on MacOS systems and how you can define a specific JVM which will be used to run the server.

1. Download Payara Server

 

Payara Server can be downloaded from http://www.payara.fish/downloads. After downloading, place it in a directory of your choice and unzip.

 

This directory will be referred to as <PAYARA_HOME>.

 

2. Verify Your Java Version

 

Since Payara Server 5 only runs on Java 8 for the moment, you need to make sure you have this version installed on your computer.

 

You can verify the default Java version by running the following command in a terminal window:

 

java -version

 

3. Install Java Version

 

There are several options if you need to adjust or install Java.

 

3.1 New Installation

 

You can download a Java 8 version for MacOS from Oracle or from Azul, a Payara partner.

 

Azul download page: https://www.azul.com/downloads/zulu/zulu-mac/

 

Oracle download page:  https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

 

There is no Java 8 build from OpenJDK available.

 

Follow the installation procedure which you can find for these downloads.

 

You can retrieve the location where the installation took place by executing this command in a terminal window.

 

/usr/libexec/java_home -V

 

You should find your Java 8 installation in the /Library/Java/JavaVirtualMachines/ directory.

 

Verify (or otherwise adjust) that your PATH and JAVA_HOME environment variables reference the installation directory. If not, you can adjust them in the  ~/.bash_profile file like this:

 

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home

export PATH=$JAVA_HOME/bin:$PATH

 

3.2 Change Java Version Globally

 

If you already have Java installed, but not version 8, you can install multiple versions as described in the previous point.

 

By using the Java 8 installation in the PATH and JAVA_HOME environment variables, Payara Server will use the correct version.

 

3.3 Change Java Version Specific for Payara Server

 

In case you can’t change your version globally as described in the previous paragraph, because you have other programs which need to work with a different version, you are able to define it for Payara Server only.

 

Open the file <PAYARA_HOME>/glassfish/config/asenv.conf and add the following entry

 

AS_JAVA=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home

 

The directory must be of course the location where your Java installation can be found and can be retrieved by the following command in the terminal

 

/usr/libexec/java_home -V

 

4. Starting the Server

 

Open a Terminal window and change the directory to the <PAYARA_HOME>/bin directory and enter the following command.

 

./asadmin start-domain

 

This will start-up the default domain, ideal for application development,  from the Payara Server.

 

There should be no errors shown on the terminal console and the web console can be accessed from your browser at the URL http://localhost:4848.

 

Here you can modify and/or customize your Payara Server installation, as well as on the command line with the asadmin tool. The commands of the CLI can be found at https://docs.payara.fish/documentation/payara-server/asadmin-commands/asadmin-commands.html.

 

Get Started With Payara Server:

{{cta(‘bd21989b-afba-4c77-b96b-5372331505cb’,’justifycenter’)}}

 

 

 

 

 

Comments (4)

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. Bert De Koster

    I followed the steps but when I enter the last command to run it, I get an error:
    “Could not find a JVM. Make sure either JAVA_HOME is set correctly in your environment, AS_JAVA is set correctly in the config/asenv file, or java-home is set correctly in the domain.xml configuration.”

    On my machine multiple versions of java are installed. /usr/libexec/java_home -V
    Matching Java Virtual Machines (3):
    14.0.1, x86_64: “Java SE 14.0.1” /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home
    1.8.0_252, x86_64: “Zulu 8.46.0.19” /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home
    1.8.0_251, x86_64: “Java SE 8” /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home

    /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home

    I have:
    1) echo $JAVA_HOME
    /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home
    2) In asenv.conf
    AS_JAVA=/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home
    3) In domain.xml

  2. Rudy De Busscher

    Hi Bert,

    I can see that the asadmin script launches the GFLauncher but that Java Class is unable to start the JVM with the DAS.

    Are the configs made in that terminal window or defined globally in the .bash_profile.

    This problem can be discussed further in the Payara Forum https://groups.google.com/forum/#!forum/payara-forum

    Best Regards
    Rudy

  3. Maarten van Leunen

    I’ve tried starting it on my MacBook Pro, but it complains “There is a process already using the admin port 4848 — it could be another instance of Payara Server or Payara Micro.”.

    I can verify that nothing is running. I assume it is something to do with networking instead. Can you advise?

  4. Rudy De Busscher

    Hi Maarten,

    I think I vaguely remember a similar message and that it has to do with the /etc/hosts file.

    This is the contents on my machine (where is the name of your device)

    127.0.0.1 localhost
    127.0.0.1 .local
    127.0.0.1
    255.255.255.255 broadcasthost
    ::1 localhost

    Regards
    Rudy

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 […]

What Is a Java Application Server? A Short Guide 6 minutes
Jakarta EE

What Is a Java Application Server? A Short Guide

Enterprise Java applications power global commerce, healthcare, government and countless other industries. These systems must be scalable, secure and […]

10 minutes
Uncategorized

Java’s 30th Anniversary: A Celebration of Legacy, Evolution and Community

May 2025 marks a monumental milestone in software development: Java turns 30. The impact of this language on the […]