Java jdk1.8.0_181

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
CodeSchlocker

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
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
karlchen
Level 23
Level 23
Posts: 18231
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
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 792 days now.
Lifeline
CodeSchlocker

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
Locked

Return to “Software & Applications”