Get JDK (Java SE Development Kit) 5 or higher from http://java.sun.com/javase/, if you are using Solaris, Linux, or Windows.
If you are using Mac OS X, you need to download JDK 5 (supported on Mac OS X 1.4 or later) from http://www.apple.com/support/downloads/java2se50release3.html and make JDK 5 the default JVM.
If you are using AIX, download JDK 5 from: http://www.ibm.com/developerworks/java/jdk/aix/service.html.
Download the GlassFish v2 distribution https://glassfish.dev.java.net/public/downloadsindex.html.
Set the environment variable JAVA_HOME to point to the directory in which JDK 5 is installed.
Run the following command:
java -Xmx256m -jar <filename>.jar
Set ANT_HOME to point to the ant 1.6.5 installation, which is at <downloaded-dir>/glassfish/lib/ant directory.
Navigate to the glassfish directory:
cd glassfish
If you do not want clustering capabilities, run the following command:
ant -f setup.xml
Use the Admin Console or Update Center to register your installation of GlassFish. Start GlassFish using the instructions at Starting the Server in Sun Java System Application Server 9.1 Quick Start Guide.