WSO2 Identity Server - Carbon cannot execute Java
Asked Answered
C

2

6

I'm using Ubuntu 16.04 64-bit. I installed Oracle JDK jdk1.8.0_144 in /usr/local/java and set the symlinks as below.

$ 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.

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:

JAVA_HOME is not defined correctly.
CARBON cannot execute java

error.

Cottrell answered 8/9, 2017 at 14:27 Comment(1)
Try enclosing JAVA_HOME path with quotes as below, export JAVA_HOME="/usr/local/java/jdk1.8.0_144"Azerbaijan
E
4

You should try to add the following into your .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

There are many other causes of this issue:

1) You are running the server as the super user (sudo) which is not required. However I think you dont have the JAVA_HOME set in super user environment.

2) You can try: 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.

4) Your version of Identity Server does not support java 8.

Ectoderm answered 8/9, 2017 at 17:0 Comment(1)
Identity Server do support java 8 since version 5.1.0. Refer docs.wso2.com/display/IS510/Installation+PrerequisitesAzerbaijan
P
0

replace your java home path in wso2server.sh line no 52

#JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home

JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

Predictor answered 23/2, 2021 at 9:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.