0

I followed this documentation to install java-1.8.0-openjdk-1.8.0.272.b10-1.portable.jdk.el.x86_64.tar.xz into RHEL 7.3.

In section 2.4. Installing OpenJDK on RHEL using an archive, at the last step, 7.Verify that javac -version works without supplying the full path:

$ javac -version
-bash: javac:command not found

I have appended the .bashrc file in the respective user account as follows:

export JAVA_HOME=~/jres/java-8
export PATH="$JAVA_HOME/bin:$PATH"

The full path for JAVA_HOME was: /home/myaccount/jres/java_8

I also edited the .bash_profile inside the /root folder with the

export JAVA_HOME=/home/myaccount/jres/java-8

This helped root account user receive a valid response when typing echo $JAVA_HOME. But it did not solve the java command not found issue.

Will appreciate any inputs to help.

7
  • When setting JAVA_HOME, did you give the path unquoted? Does it work if you replace ~ (tilde) by $HOME? Did you log in again after the change to your .bashrc? The file is only sourced for new shell sessions. Commented Jan 13, 2021 at 7:38
  • Yes, unquoted. It still does not work. I did login again. The error persisted. Commented Jan 13, 2021 at 8:30
  • Have you actually looked where the javac executable got installed? Try find ~/jres -name javac. Commented Jan 13, 2021 at 8:41
  • No. Thanks for asking. When I typed this command, there was no output or errors. The location ~/jres/java-8 was created using symlink of the JDK location at /usr/java/jres/java-1.8.0-openjdk-1.8.0.272.b10-1.portable.jdk.el.x86_64, after I searched this JDK location, I found it in the bin folder. Commented Jan 13, 2021 at 8:59
  • Yes, resolved. Thank you @Kusalananda ! Commented Jan 13, 2021 at 9:16

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.