Install Glassfish Web Server on Windows

Follow us on our fanpages to receive notifications every time there are new articles. Facebook Twitter

1- Introduction

This document is based on:
  • Glassfish 5.0

  • Windows (ALL)

2- What is Glassfish Server

Glassfish Server is a webserver, allowing you to deploy web applications written on java. Like some other Webserver:
  • Tomcat
  • Weblogic
  • Websphere
  • JBoss
  • ....
You may be so familiar with Tomcat, a webserver serves for the purpose of studying and development applications. Glassfish developed by Sun is stronger than Tomcat. After Java part was sold to Oracle, Glassfish becomes the product of Oracle. Currently, Glassfish server has two version: a free version with open source code, and a commercial version.
In this document I will guide you to install and configure Glassfish free version.

3- Download

After downloading, you have one file:

4- Start with Glassfish

Unzip Glassfish to specific folder on the hard drive:
Declare Java Home:
Glassfish5 requires you to use Java8 or newer. You need to declare the location of the Java:
Go to:
  • <Glassfish_Home>/glassfish/config
Edit File:
  • asenv.bat
Add configuration:
  • set path=<Java_Location>/bin
Run Glassfish
Open CMD and cd to:
  • <GlassFish_Home>/bin
Move to:
  • cd C:\glassfish5\bin
To start domain1 on Glassfish server:
  • asadmin start-domain domain1
To stop domain1:
  • asadmin stop-domain domain1
domain1 has been successful start.
Open URL:
Try deploying a web application:
You can download a demo web application at:
By default after being deployed, the application is run on port 8080. You can change to other port, or change to port 80. Configuration is discussed in detail below.

5- Change port 8080 to 80

6- Create Window Service for Glassfish Server

Open CMD as Administrator.
CD to bin folder of Glassfish:
Run command:

asadmin create-service --name domain1