Search code examples
javalinuxubuntuinstallationarchive

Install JDK on Linux with .tar.gz archive


I'm trying to install the .tar.gz package on my new ubuntu machine. I'm coming from Windows Environment. Usually after the package have been extracted one can easily call "java -version" on the folder where the binaries are located.

However my archive binaries, which I extracted on a custom folder, are not found when typing

These are my environment variables:

franrizz16@sviappmfa01:~/programs/java/jdk1.8.0_202/bin$ echo $JAVA_HOME
/home/franrizz16/programs/java/jdk1.8.0_202
franrizz16@sviappmfa01:~/programs/java/jdk1.8.0_202/bin$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/franrizz16/programs/java/jdk1.8.0_202/bin

when typing "java -version" the output is the following:

-bash: /home/franrizz16/programs/java/jdk1.8.0_202/bin/java: No such file or directory

but the file actually exists in "bin" folder.

I expected that typing "java -version" would output the jdk version.

This is my ls on $JAVA_HOME/bin folder: enter image description here

What am I missing?

Thanks


Solution

  • Given what you wrote in your comments, you downloaded the 32-bit version of the jdk. You need to download the 64-bit (x86_64) one.

    You mentioned you are accustomed to Windows running both 32-bit and 64-bit programs. While 64-bit versions of Linux can run 32-bit programs just fine, they don't do it out of the box. You'll need to install 32-bit library support. See this thread on how to do it.

    But unless you have very specific reasons to run 32-bit software on a 64-bit machine, you're better off simply installing the correct version.

    (Note, here I'm talking about x86 specifically. I don't know whether ARM or MIPS behave differently regarding 32- vs 64-bit).