Installing glassfish on Mountain Lion I downloaded glassfish-3.1.2.2-unix.sh from glassfish.java.net. To install I did 

chmod +x glassfish-3.1.2.2-unix.sh 


then i tried to run it :

$ ./glassfish-3.1.2.2-unix.sh 
This program requires DISPLAY environment variable to be set.
Please re-run after assigning an appropriate value to DISPLAY.


Any idea ?

Thanks
The DISPLAY variable tells the X11 libraries where the X11 server is located.

Try

 export DISPLAY=:0


I do not believe the Unix installer supports installing OS X services, so unless you have very explicit needs at this time you can get along just with the zip-distribution of Glassfish.  Unzip it and run asadmin start-domain.