If you install a Linux OS, the developers usually already included a JVM to the system to run some programs that need Java. It must work in any other Linux distro such as Slackware, Fedora, Ubuntu et cetera.
Since I use Centos 5.4 x86_64 in everyday life, this guide is showing you how to install JDK in Centos 5.4 64bit. That’s it, the JDK 6.0 update 31 is installed.This tutorial will guide you on how to install JDK (Java Development Kit) on Linux. Lastly, verify that JAVA_HOME is set correctly for the sudo user: Type the following commands to finish the setup and verify that everything is setup correctly. Or if you do, ensure that you change magic quotes to straight quotes in your editor.Įnter the following at the bottom of the file: This will cause problems when you try to use your JVM in certain applications.ĭo not copy/paste the JAVA_HOME value below. WordPress displays the quotes around the JAVA_HOME value below as magic quotes. Open a terminal, then enter the following commands: Which is followed by a long usage message.Ĭreate the JAVA_HOME environment variable Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode) Java(TM) SE Runtime Environment (build 1.6.0_31-b04) There is only one alternative in link group javaws: /usr/lib/jvm/jdk1.6.0_31/bin/javawsĪs a final step, let’s test each of the commands to ensure everything is setup correctly. However, if you get a list of options, just type in the number of the path to the Oracle javaws command, and press Enter. There is only one alternative in link group javac: /usr/lib/jvm/jdk1.6.0_31/bin/javacĪs with javac, I did not have the OpenJDK version of javaws installed, so my output was simple. In my case, I had not previously installed the OpenJDK javac binary, so my output looked like the following: Press 1 on your keyboard, then press Enter.įollow steps similar to those listed above if you are presented with a list of options. On my system I did the following (change the number that is appropriate for your system):
* 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 auto modeġ /usr/lib/jvm/jdk1.6.0_31/bin/java 1 manual modeĢ /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode There are 2 choices for the alternative java (providing /usr/bin/java). Read through the list and find the number for the Oracle JDK installation (/usr/lib/jvm/jdk1.6.0_26/bin/java) You will see output similar to the following (although it’ll differ on your system). Sudo update-alternatives -install "/usr/bin/javaws" "javaws" \ Sudo update-alternatives -install "/usr/bin/javac" "javac" \ Sudo update-alternatives -install "/usr/bin/java" "java" \
The next 3 commands are split across 2 lines per command due to width limits in the blog’s theme. The jvm directory is used to organize all JDK/JVM versions in a single parent directory. Login to with your Oracle accountĭownload the JDK to your ~/Downloads directoryĪfter downloading, open a terminal, then enter the following commands.
I have a 64 bit version of Ubuntu 12.04 LTS installed, so the instructions below only apply to this OS. Mainly I have changed the JDK from 1.6.0_26 to 1.6.0_31 as this is the recommended JDK for CDH4. This is an update to an older version of this post.
The answer is that Oracle JDK 6.0 update 31 is the JDK recommended by Cloudera when installing CDH4 (Cloudera Distribution Hadoop v4). The first question is why are we installing an old JDK. Install Java JDK 6.0 update 31 on Ubuntu 12.04 LTS