Failing to set up Openmrs SDK on Linux Os

Am setting up openmrs sdk on my Linux os but each time i run this (mvn org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:setup-sdk ) command it keeps on throwing this exception. Have tried to follow several tutorials and documentations on google but have not yet achieved success. I need help


did you consider this The JAVA_HOME environment variable is not defined correctly from your log ?

Your Java Environment is not correctly configured to support applications.

@tendomart I understood the error but failing to resolve it.Have tried to edit ./bashrc script by adding
export JAVA_HOME
export PATH=$PATH:$JAVA_HOME/bin)
as most documentation suggests but its not working out.

Give all the details of what you’re doing…We cannot guess your system specs.

Plus what do you get when you type the following in Terminal ?

javac -version

java -version

mvn -v

java -version:
openjdk version “1.8.0_222” OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10) OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

javac -version:
javac 1.8.0_222

mvn -v:
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE

I installed maven and i can see it in maven: /etc/maven /usr/share/maven directory
cc: @tendomart, @jwnasambu

@kdaud could you try using some other sub version of jdk 1.18.0 ,may be you can try it with 1.8.0_201?

@kdaud try restarting your machine.

What do you get when you run

sudo update-alternatives --config java

and sudo update-alternatives --config javac

sudo update-alternatives --config java gives
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java Nothing to configure.

sudo update-alternatives --config java gives
There is only one alternative in link group javac (providing /usr/bin/javac): /usr/lib/jvm/java-8-openjdk-amd64/bin/javac Nothing to configure.

Can this be of help?

find /usr/lib/jvm/java-1.x.x-openjdk

vim /etc/profile

Prepend sudo if logged in as not-privileged user, ie. sudo vim
Press 'i' to get in insert mode


export JAVA_HOME="path that you found"

export PATH=$JAVA_HOME/bin:$PATH

logout and login again, reboot, or use source /etc/profile to apply changes immediately in your current shell

Have tried several times editing /etc/profile but the error persists. Uninstalling openjdk and giving a try to oracle jdk is now am trying to find out whether would yield success

Ok. Waiting for the outcome.

@kdaud I don’t know what you are using. But for starters you can install nano. In the command line type in

sudo apt-get update


sudo apt-get install nano


sudo nano /etc/profile

an editor will open and paste these lines after the last fi

export JAVA_HOME
export PATH 

Press Ctrl and O,
press Enter,
Press Ctlr and X

paste this in the commandline   source /etc/profile

exit and restart your machine

let me know what you get. 

I would not advise you to go to oracle, just stick to open jdk, Don't easily give up the fight. :)

@irenyak1, I find it fun using gedit or nano. So I use them

@kdaud yes go ahead and follow the steps

1 Like

which step have you reached on this?are you able to install the sdk successfully?

I finally figured out the error after exporting the JAVA_HOME and PATH in .bashrc . Exporting it into /etc/profile didn’t work out.
I added export JAVA_HOME=/usr/lib/java/jdk1.8.0_221
export PATH="$PATH:$JAVA_HOME/bin"
in .bashrc script and the issue was resolved

1 Like

great!!! the issue was about setting up the environment variable for java

1 Like