You experience JDK-related issues in a variety of circumstances.
GlassFish Server 3.0.1 requires JDK 6, so check your system for that dependency.
The minimum (and certified) version of the JDK software that is required for GlassFish Server depends on the operating system:
For supported operating systems except Mac OS, the minimum required version is 1.6.0_17.
For the Mac OS X operating system, the minimum required version is 1.6.0_15.
Ensure that the required JDK software is installed and that the JAVA_HOME environment variable points to the JDK installation directory, not the Java Runtime Environment (JRETM) software.
Set JAVA_HOME and $JAVA_HOME/bin in the PATH to point to the supported JDK version.