我在Apache Sierra上使用Apache James作为电子邮件服务器进行开发 - v 10.12.3
当我尝试以超级用户身份启动/运行时
sudo ./run.sh
我收到以下错误:
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.
当我尝试在没有sudo的情况下运行它时,我得到以下内容:
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)
到目前为止,我知道JAVA_HOME变量设置正确。
当我在终端输入$ JAVA_HOME时,我得到:
-bash: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home: is a directory
在.profile和.bash_profile文件中我有:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
任何想法可以理由是什么?
答案 0 :(得分:0)
已解决...解决方案是为Sudo设置JAVA_HOME环境变量。这是在/etc/sudoers
完成的。我使用了' vi'通过终端编辑文件。
sudo visudo
然后在环境变量的默认设置之后添加以下行:
Defaults env_keep += "JAVA_HOME"
这就是全部。要检查是否为sudo正确设置了JAVA_HOME环境变量,我只需在终端中输入此命令。
sudo printenv