Get JDK 5 Update 14 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 from http://developer.apple.com/java/download/ and make JDK the default JVM.
If you are using AIX, you need to download JDK from http://www.ibm.com/developerworks/systems/library/es-JavaOnAix_install.html and make JDK the default JVM.
Download the GlassFish v2.1 distribution from 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
If you have trouble running this command, run this command with a higher —Xmx value. Example, java -Xmx512m -jar filename.jar
Navigate to the glassfish directory:
If you are using operating system that is a derivative of UNIX:
chmod -R +x lib/ant/bin
Run one of the following commands:
If you want GlassFish with clustering, run the following command:
lib/ant/bin/ant -f setup-cluster.xml
Or, for Windows: lib\ant\bin\ant -f setup-cluster.xml
If you want GlassFish without clustering, run the following command:
lib/ant/bin/ant -f setup.xml
Or, for Windows: lib\ant\bin\ant -f setup.xml
Use the Admin Console to register your installation of GlassFish. Start GlassFish using the instructions in the Quick Start guide.