I have installed ServiceMix on my machine, and am trying to start it. The startup script is called start.sh. When I did
./start.sh, it gave me a Permission Denied message. So I used
sudo ./start.sh, which starts the server fine.
However, it seems to be using Java 7, when I would like to use Java 6 (for various reasons). I looked through the start.sh script and found that it uses the
JAVA_HOME variable. So I set my JAVA_HOME to the JDK 6 directory.
However, ServiceMix still uses Java 7.
A Google search revealed that when a command is run with sudo, sudo removes certain environment variables. So I did
sudo -E ./start.sh. Again, it used JDK 7.
I opened the start.sh and added a line,
echo $JAVA_HOME to see whether the variable is set properly or not. The output of
echo was an empty line.
I tried modifying the /etc/sudoers file to include
Defaults env_keep += "JAVA_HOME". Executing start.sh now tells me that my echo statement is again an empty line. ServiceMix still uses JDK 7.
I tried setting JAVA_HOME in
/etc/profile. Executing start.sh now tells me that my echo statement is again an empty line. Again, ServiceMix uses JDK 7.
What mistake am I doing here?
FWIW, am on Mac OS X 10.8.2.
echo $SHELL on my terminal returns /bin/bash. When I use
sudo su and fire
echo $SHELL, it returns /bin/sh.