OracleJDK (Installing)
Instructions and tips for installing the Oracle SE JDK in a users account. Since this is a binary package, installing is fairly straightforward. Each user can install software in their own account, without any extra permissions. These instructions are specifically for version 8u181, but should work just the same for any other version.
Download
To download the software, google oracle jdk downloads, or go directly to the download page.
Once on the download page, scroll down to the desired version and click on the JDK Download button. From there you'll be presented with a page containing a section similar to this:
Accept License
Oracle requires users to accept a license before being allowed to download; accept the license by clicking on the Accept License Agreement button, shown highlighted by the top orange box in the image above.
Download Correct Version
Now that we have accepted the license, we can download the JDK. Look for the Linux x64 version, and the filename ending in tar.gz. The second orange box in the image above shows the appropriate file to download. Click the appropriate file and download it to you computer.
Copy Package to Magnolia
Copy the download file from your computer to Magnolia is beyond the scope of this article, but for help try googling how to use scp if you are on Linux or a Mac, or how to use PuTTY if you are on a Windows machine.
Installing
We assume that the user has copied the JDK file to their home directory. After connecting to Magnolia, check that the file is there with:
user $
ls -lh *.tar.gz
-rw-r--r-- 1 users users 178M Sep 28 17:39 jdk-8u181-linux-x64.tar.gz
Since in all likelihood we will be needing to install additional packages in our accounts, lets make a directory where we will put all the packages we install. Make a directory called Installed and move into that directory:
user $
mkdir Installed
user $
cd Installed
Extracting Files from the Package
Now that we are in the Installed directory, extract all the files from the JDK package we downloaded:
user $
tar xlvf ../jdk-8u181-linux-x64.tar.gz
A long list of files will scroll past as they are extracted. Once the extraction is complete, listing the directory contents shows that a new directory has been created:
user $
ls
jdk1.8.0_181
Looking inside the new directory we see a bunch files, along with more directories:
user $
ls jdk1.8.0_181
bin lib src.zip COPYRIGHT LICENSE THIRDPARTYLICENSEREADME-JAVAFX.txt include man THIRDPARTYLICENSEREADME.txt javafx-src.zip README.html jre release
When installing packages on Linux, a few directories are common, namely: bin, lib, include, and man. We see that all of these exist, which is good. The bin directories usually contain the binaries that we run, so let see what is there:
user $
ls jdk1.8.0_181/bin
appletviewer javafxpackager jdb jrunscript pack200 unpack200 ControlPanel javah jdeps jsadebugd policytool wsgen extcheck javap jhat jstack rmic wsimport idlj javapackager jinfo jstat rmid xjc jar java-rmi.cgi jjs jstatd rmiregistry jarsigner javaws jmap jvisualvm schemagen java jcmd jmc keytool serialver javac jconsole jmc.ini native2ascii servertool javadoc jcontrol jps orbd tnameserv
Now we see some programs we are expecting: java and javac. Lets try the programs and make sure the versions are correct:
user $
java -version
openjdk version "1.8.0_131" OpenJDK Runtime Environment (build 1.8.0_131-b12) OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
user $
javac version
javac 1.8.0_131
Both java and javac run, but they are not the version we expected: 1.8.0_131 instead of 1.8.0_181. This is because we have not told Linux where to find the new programs, and instead ran the default system installed java and javac programs. We can see exactly which programs were run by using the which command:
user $
which java javac
/usr/bin/java /usr/bin/javac
We see that the programs in the /usr/bin directory were run, where we want to use the programs in $HOME/Installed/jdk1.8.0_181/bin ($HOME is a variable that expands to each users home directory). Luckily, this is easy to fix by using the $PATH variable.
user $
which java javac
~/Installed/jdk1.8.0_181/bin/java ~/Installed/jdk1.8.0_181/bin/javac
user $
java -version
java version "1.8.0_181" Java(TM) SE Runtime Environment (build 1.8.0_181-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
user $
javac -version
javac 1.8.0_181