I have Glassfish 3.1.2 installed on Ubuntu, I've set up a separate "glassfish" user to run it as and have JDK 1.7.0 installed. If I log in as the "glassfish" user and start GF via the shell:
/usr/local/java/glassfish/glassfish-3.1.2/glassfish/bin/asadmin start-domain domain1
It starts up fine, so I think I have everything installed ok. The problem is trying to start it with the following init.d script:
#! /bin/sh
export AS_JAVA=/usr/local/java/jdk1.7.0
GLASSFISHPATH=/usr/local/java/glassfish/glassfish-3.1.2/glassfish/bin
case "$1" in
start)
echo "starting glassfish from $GLASSFISHPATH"
sudo -u glassfish $GLASSFISHPATH/asadmin start-domain domain1
;;
restart)
$0 stop
$0 start
;;
stop)
echo "stopping glassfish from $GLASSFISHPATH"
sudo -u glassfish $GLASSFISHPATH/asadmin stop-domain domain1
;;
*)
echo $"usage: $0 {start|stop|restart}"
exit 3
;;
esac
:
On trying that I get:
exec: 54: java: not found
I've also tried adding the following line to the init.d script:
export PATH=/usr/local/java/jdk1.7.0/bin:$PATH
But that didn't seem to do anything. I've been using instructions on http://www.nabisoft.com/tutorials/glassfish/installing-glassfish-301-on-ubuntu to get this far. As someone more familiar with Windows I'd really appreaciate any help identifying the problem. Thanks.