As a developer, there are a number of packages that you may use that require the JDK.
For Node.js developers the WebStorm IDE requires Java. For data engineers, many big data technologies require Java including Cassandra and Hadoop. For mobile developers the Android Studio requires a JDK.
Create a directory for the locally installed JDK.
mkdir -p ~/opt/packages
As of the date of this post, the current JDK version is Java Platform (JDK) 7u75.
Wait for the download to finish.
Open a terminal, then enter the following commands:
cd ~/opt/packages gzip -dc jdk-7u75-linux-x64.tar.gz | tar xf -
The jvm directory is used to organize all JDK/JVM versions in a single parent directory.
sudo mkdir /usr/lib/jvm sudo mv jdk1.7.0_75 /usr/lib/jvm
Next, add the new JDK to the alternatives list. If you see multiple JDK/JVM versions listed in the output from any of the commands below, then select JDK 1.7.0 u75 as your primary JDK.
sudo update-alternatives --install "/usr/bin/java" "java" \ "/usr/lib/jvm/jdk1.7.0_75/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" \ "/usr/lib/jvm/jdk1.7.0_75/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" \ "/usr/lib/jvm/jdk1.7.0_75/bin/javaws" 1 # Select jdk_1.7.0_75 for java, javac, and javaws sudo update-alternatives --config java sudo update-alternatives --config javac sudo update-alternatives --config javaws
As a final step, let’s test each of the commands to ensure everything is setup correctly.
java -version # Expected output: # java version "1.7.0_75" # Java(TM) SE Runtime Environment (build 1.7.0_75-b14) # Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode) javac -version # Expected output: javac 1.7.0_75 javaws -version # Expected output: Java(TM) Web Start 10.75.2.13-fcs, which is followed by a long usage message.
That’s it, the JDK 1.7.0 update 75 is installed.
We specialize in helping professional developers, like you, expand your skill set. Our courses are focused on enabling you to learn everything necessary to use a new technology in a live, production application.
All courses are made with love in
Palo Alto, CA.
Subscribe to our newsletter