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:
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.
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:
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
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
4. Starting the Server
Open a Terminal window and change the directory to the <PAYARA_HOME>/bin directory and enter the following command.
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: