问题
I'm using Apache James as email server for development purpose on mac Sierra - v 10.12.3
When I try to start/run it as super user
sudo ./run.sh
it I get the following error:
ERROR: JAVA_HOME not found in your environment.
Please, set the JAVA_HOME variable in your environment to match the
location of the Java Virtual Machine you want to use.
When I try to run it without sudo, I get the following:
Using PHOENIX_HOME: /Users/myUserName/Dev/james-2.3.2.1
Using PHOENIX_TMPDIR: /Users/myUserName/Dev/james-2.3.2.1/temp
Using JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
Running Phoenix:
Phoenix 4.2
James Mail Server 2.3.2.1
Remote Manager Service started plain:4555
org.apache.avalon.phoenix.containerkit.lifecycle.LifecycleException: Component named "pop3server" failed to pass through the Starting stage. (Reason: java.net.BindException: Permission denied (Bind failed)).
at org.apache.avalon.phoenix.containerkit.lifecycle.LifecycleHelper.fail(LifecycleHelper.java:354)
The JAVA_HOME variable has been set correctly so far I know.
When I type $JAVA_HOME in terminal I get:
-bash: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home: is a directory
in .profile and .bash_profile files I do have:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
Any idea what could the reason be please?
回答1:
Resolved... the solution was to set the JAVA_HOME Environment Variable for Sudo. and this was done on: /etc/sudoers
. I used 'vi' to edit the file via terminal.
sudo visudo
and then adding the following line after the Default settings for Environment Variables:
Defaults env_keep += "JAVA_HOME"
That's all. To Check if the JAVA_HOME Environment Variable has been set correctly for sudo, I just typed this command in the terminal.
sudo printenv
来源:https://stackoverflow.com/questions/43183197/cant-run-apache-james-on-mac-sierra