[英]WSO2 Identity Server - Carbon cannot execute Java
I'm using Ubuntu 16.04 64-bit.我正在使用 Ubuntu 16.04 64 位。 I installed Oracle JDK jdk1.8.0_144
in /usr/local/java
and set the symlinks as below.我在/usr/local/java
安装了 Oracle JDK jdk1.8.0_144
并设置了如下符号链接。
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_144/jre/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_144/bin/javac" 1
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_144/jre/bin/javaws" 1
$ sudo update-alternatives --set java /usr/local/java/jdk1.8.0_144/jre/bin/java
$ sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_144/bin/javac
$ sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_144/jre/bin/javaws
After that, I followed the installation guide in the WSO2 documentation and set JAVA_HOME
as below.之后,我按照 WSO2 文档中的安装指南将JAVA_HOME
为如下。
nano /.bashrc
added the variable:添加了变量:
export JAVA_HOME=/usr/local/java/jdk1.8.0_144
export PATH=${JAVA_HOME}/bin:${PATH}
I close the old terminals and open a new one and run:我关闭旧终端并打开一个新终端并运行:
echo $JAVA_HOME
and I get我得到
/usr/local/java/jdk1.8.0_144
However, when I run sh wso2server.sh
I get the error:但是,当我运行sh wso2server.sh
出现错误:
JAVA_HOME is not defined correctly.
CARBON cannot execute java
error.错误。
You should try to add the following into your .bash_profile
您应该尝试将以下内容添加到您的.bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$JAVA_HOME/jre/bin:$PATH
There is similar issue: Ubuntu: JAVA_HOME is not defined correctly有类似的问题: Ubuntu: JAVA_HOME 没有正确定义
There are many other causes of this issue:此问题还有许多其他原因:
1) You are running the server as the super user (sudo) which is not required. 1)您以不需要的超级用户(sudo)身份运行服务器。 However I think you dont have the JAVA_HOME
set in super user environment.但是我认为您没有在超级用户环境中设置JAVA_HOME
。
2) You can try: sudo JAVA_HOME=/usr/lib/jvm/java-7-oracle ./wso2server.sh
2)您可以尝试: sudo JAVA_HOME=/usr/lib/jvm/java-7-oracle ./wso2server.sh
3) You should probably be setting JAVA_HOME
to /usr/lib/jvm/jdk1.7.0/jre
rather than /usr/lib/jvm/jdk1.7.0
. 3)您可能应该将JAVA_HOME
为/usr/lib/jvm/jdk1.7.0/jre
而不是/usr/lib/jvm/jdk1.7.0
。
4) Your version of Identity Server does not support java 8. 4) 您的身份服务器版本不支持 java 8。
replace your java home path in wso2server.sh line no 52替换 wso2server.sh 第 52 行中的 java 主路径
#JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.