0

Java -version in Linux is not seem to be working and returing -bash: java: command not found error,though im able to run java related apps.

I have installed jdk in my new linux machine and i have set the environment variable JAVA_HOME using which i can execute JAVA apps and I can echo the java path i set.

Problem is i can not see the java version i have installed ,using the command java -version (i want to know that everything is set fine)

can someone guide me ,what i am missing here.

2
  • Did you update PATH too? Commented Mar 28, 2019 at 11:54
  • i have used the command : export JAVA_HOME=/home/ec2-user/jdk1.8.0_151 to set and also i have tried with echo 'export JAVA_HOME=/home/ec2-user/jdk1.8.0_151 $JAVA_HOME' >>~/.bash_profile source .bash_profile ....is there somthing i am mising Commented Mar 28, 2019 at 11:56

1 Answer 1

2

You should have your java installation directory added to PATH environment variable in order to use java from terminal. For example:

export PATH=<your java Directory>/bin:$PATH
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.