Sunday, March 25, 2018

Java Runtime Environment (JRE) not found (linux ubuntu)




I just install java following the easy to follow guide: https://www.java.com/en/download/help/linux_x64_install.xml.



So by step I:


1) Downloaded jre-8u221-linux-x64(1).tar.gz from my browser (ubunto Gnome)


2) I moved it to my desired path so: /:mv jre-8u221-linux-x64(1).tar.gz /usr/java


3) I changed permission on it /:sudo chmod 777 jre-8u221-linux-x64(1).tar.gz



4) Unzip it: tar zxvf jre-8u73-linux-x64.tar.gz


5) Now done.


If I do a: java -version I obtain:


The program 'java' can be found in the following packages:
* default-jre
* gcj-5-jre-headless
* openjdk-8-jre-headless

* gcj-4.8-jre-headless
* gcj-4.9-jre-headless
* openjdk-9-jre-headless
Try: apt install



As if my java is not detected even if it"s installed...


root@:/usr/java#:ls
bin lib plugin THIRDPARTYLICENSEREADME-JAVAFX.txt

COPYRIGHT LICENSE README THIRDPARTYLICENSEREADME.txt
jre1.8.0_221 man release Welcome.html


root@:/usr/java#:cd jre1.8.0_221/


root@:/usr/java/jre1.8.0_221/#:ls
bin lib man README THIRDPARTYLICENSEREADME-JAVAFX.txt Welcome.html
COPYRIGHT LICENSE plugin release THIRDPARTYLICENSEREADME.txt


root@:/usr/java/jre1.8.0_221/#:cd bin


root@:/usr/java/jre1.8.0_221/bin/#:ls
ControlPanel javaws jjs orbd policytool rmiregistry tnameserv
java jcontrol keytool pack200 rmid servertool unpack200


As we can see java is here (/usr/java/jre1.8.0_221/bin/java)


So I don't know what to do, my programs don't detect my java until I define the path and when I execute java -version the version is not detected...


Please help



Answer



Edit your ~/.bashrc file and add the following lines:



export JAVA_HOME=/usr/java/
export PATH=$PATH:$JAVA_HOME/bin
export JRE_HOME=/usr/java/jre1.8.0_221


Save the changes, exit and restart your bash shell.




Type in java -version to check if it has worked.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...