Java jdk1.8.0_181

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
CodeSchlocker
Level 1
Level 1
Posts: 11
Joined: Mon Aug 27, 2018 11:42 pm

Java jdk1.8.0_181

Post 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?

-Thanks
-CodeSchocker

User avatar
karlchen
Level 20
Level 20
Posts: 12271
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Java jdk1.8.0_181

Post 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,
Karl
Image
Linux Mint 19.2 64-bit Cinnamon, Total Commander 9.22a 64-bit
Haß gleicht einer Krankheit, dem Miserere, wo man vorne herausgibt, was eigentlich hinten wegsollte. (Goethe)

CodeSchlocker
Level 1
Level 1
Posts: 11
Joined: Mon Aug 27, 2018 11:42 pm

Re: Java jdk1.8.0_181

Post 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,
CodeSchlocker

Post Reply

Return to “Software & Applications”