Can't run Apache james on mac Sierra

狂风中的少年 提交于 2021-02-05 10:41:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!