However, some java programmes does not work well on OpenJDK, and achives better performance on Sun/Oracle JDK. For example, Intellij Idea in Archlinux official repository produces warning message blaming OpenJDK. So Sun/Oracle JDK maybe welcomed by some users who wanted a clean installation of Intellij Idea.
Choose and download the JDK version you want to install.
Offical supported JDK version is 1.7 and 1.8. This post covers both of them.
JDK 1.7 : jdk-7u79-linux-x64.tar.gz JDK 1.8 : jdk-8u45-linux-x64.tar.gz
Note: according to your platform (i686 or X86_64), the subversion string (7u79 or 8u45) and (x64) may differ in file names.
Extract JDK files into installation directory.
tar zxvf jdk-7u79-linux-x64.tar.gz -C /opt
tar zxvf jdk-8u45-linux-x64.tar.gz -C /opt
Suppose your jdk is extracted into /opt/jdk.
Setup JAVA_HOME variable and add executables into PATH.
#!/bin/bash export JAVA_HOME=/opt/jdk export PATH=$PATH:$JAVA_HOME/jre/bin
Finally, set java.sh executable.
chmod u+x /etc/profile.d/java.sh
Test your installation.
Output may look like:
java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
Install a java IDE and start you java developing trip.
Eclipse is most widely used by Java developers.
Intellij Idea works more geek.
NetBeans is a product of Oracle.
I used Intellij Idea right now, and it works well.