I just installed JDK in Ubuntu. When I want to use the java
command, I get this error:
/usr/bin/java: No such file or directory
but I declare the java home using update-alternatives
:
update-alternatives --config java
There is 1 choice for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/local/java/jdk1.8.0_111/bin/java 1 auto mode
* 1 /usr/local/java/jdk1.8.0_111/bin/java 1 manual mode
Press <enter> to keep the current choice[*], or type selection number:
Even when I run java in /usr/local/java/jdk1.8.0_111/bin/ directory, it doesn't recognize it.
Thanks for any help.
I read this answer, but it didn't help me and I still have the same error.
JAVA_HOME
did you declare? – Kalle Richter Aug 21 '18 at 19:11/usr/local/java/jdk1.8.0_111/bin/java -version
and place that path in your/home/$USER/.bashrc
file – George Udosen Aug 21 '18 at 19:14