Page 1 of 1

Java jdk1.8.0_181

Posted: Tue Sep 25, 2018 12:12 am
by CodeSchlocker
Hello all,

And, thanks for the help in the past.

I want to install the Java Developer Kit, along with Apache-Maven, so that I can do some Java tutorials in VS Code.

I installed jdk1.8.0_181 to /opt/java/jdk1.8.0_181/bin and apache-maven to /home/mike/apache-maven/apache-maven-3.5.4/bin.

According to instructions, I have to set the environmental variable JAVA_HOME to the directory that contains the files java and javac. I did this using the command export JAVA_HOME=/opt/java/jdk1.8.0_181/bin.

I also changed the PATH environmental value to include :/home/mike/apache-maven/apache-maven-3.5.4/bin

However, when I type mvn -v, I get the error message: The JAVA_HOME environmental variable is not defined correctly.

I make sure that JAVA_HOME is set correctly by using echo $JAVA_HOME, and it is pointing to the correct directory. Also, I go to the directory, and type ls, and I can see java and javac.

Any suggestions as to what I'm doing wrong?


Re: Java jdk1.8.0_181

Posted: Tue Sep 25, 2018 7:10 pm
by karlchen
Hi, CodeSchlocker.

JAVA_HOME is the directory level above the "bin" directory. Therefore the correct export command in your case would read

Code: Select all

export JAVA_HOME=/opt/java/jdk1.8.0_181
Best regards,

Re: Java jdk1.8.0_181

Posted: Wed Sep 26, 2018 3:06 pm
by CodeSchlocker
Thanks, Karl,

That seems to straighten out the JAVA_HOME environmental variable issue.

But, I just run mvn -v again and get a message from bash saying that I need to install it, which, I believe I already have.

I think I know the issue. I need to edit PATH in the .bashrc or the .profile. I think that issue is that the PATH I was using the other day was only temporary.

Yes, that did the trick.

Thanks again,