Skip to content
Advertisement

How to resolve Error: JAVA_HOME is not defined correctly

I have a wso2 identity server and I am trying to restart it on putty, however when I navigate into the bin folder by typing the command cd /usr/lib64/wso2/wso2is/5.11.0/bin and then type sh wso2server.sh to start the server I get the following error:

Error: JAVA_HOME is not defined correctly. CARBON cannot execute /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.332.b09-2.el8_6.x86_64/bin/java

My error logs also say ” Halting JVM “

Previously when starting the server it would run and the moment I closed putty the url would no longer work, now however I am somehow getting a JAVA-HOME error and I am unsure about what I did to cause this.

How would I be able to resolve this error? Any assistance would be greatly appreciated.

Advertisement

Answer

The error message suggests that the JAVA_HOME environment variable is not set correctly on your system. The JAVA_HOME variable should be set to the path of your Java installation. You can set the JAVA_HOME variable by following these steps:

Open the .bashrc file in a text editor. This file is typically located in your home directory. For example, if your username is user, you can open the file by running the following command:

nano ~/.bashrc

Add the following line to the file, replacing /path/to/java with the path of your Java installation:

export JAVA_HOME=/path/to/java Save the file and exit the text editor.

Run the following command to apply the changes:

source ~/.bashrc

After setting the JAVA_HOME variable, try starting the server again and see if the error persists.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement