try using this command in the terminal:
sudo apt install default-jre
then you can try using:
java -version
to check version
Answer from neoMidori on askubuntu.comtry using this command in the terminal:
sudo apt install default-jre
then you can try using:
java -version
to check version
Do not download binaries straight from the Internet. That is not how to install software on Linux. It is how Windows users do it, but it is wrong on Linux.
Install it from the package manager. Google for instructions for your version, since you did not bother to tell us what you are running. Without detailed specific info we can't help you.
How do I install Java JRE on Linux?
I've downloaded the latest Java JRE, but how do I install it?
How do I install Java?
how to install `Eclipse JDT Language Server` correctly in a shell.nix file for a nix-shell project:
What is Java command in Linux?
What is Knowledge Pass, and how does it work?
What are related courses and blogs provided by The Knowledge Academy?
Videos
You appear to be setting JAVA_HOME and PATH only in the current terminal session.
You should adjust your JAVA_HOME and PATH variable in either .bashrc or .bash_profile in your home directory. Then maybe logout and back in. That way the PATH will be adjusted every time you open a new terminal.
https://docs.oracle.com/cd/E19062-01/sun.mgmt.ctr36/819-5418/gaznb/index.html https://linuxize.com/post/bashrc-vs-bash-profile/
With your above command you install java in your home directory. If the software is not explicitly required to be available to only this single user, I'd recommend to stick to the official filesystem hierarchy ( for example see here for a basic explanation The Linux Directory Structure, Explained ).
Since Oracle Java is a prime example for "proprietary software that doesn’t obey the standard file system hierarchy", it would best go to the /opt folder.
- Create a new folder with
sudo mkdir /opt/java - Move the .tar file there and extract it as sudo
- Optionally: Install a symlink to the /usr directory, to run java without the full path
sudo update-alternatives --install /usr/bin/java java PATH_TO_BINARY_HERE 100
Not quite sure what the JAVA_HOME variable is needed for. In Oracle's install manual it is not mentioned. If you do need this to be persistent, you'd have to add it to .bashrc or .bash_profile .