How to Install IBM Java on Ubuntu Linux
This document assumes that you might have another vendor version of Java installed on your Ubuntu Linux system, such as OpenJDK or Oracle Java which is common when you use Ubuntu Linux., ,First, of all we will remove and disable other vendor...
Step-by-Step Guide
-
Step 1: This document assumes that you might have another vendor version of Java installed on your Ubuntu Linux system
You can check which vendor version of Java you have on your system by running the following commands:
Type/Copy/Paste: java
-version Type/Copy/Paste: javac
-version Make note of your vendor version of Java -
Step 2: such as OpenJDK or Oracle Java which is common when you use Ubuntu Linux.
,,,,,,,, If you have references to the Oracle Java JDK/JRE in those files comment them out using the ## symbol.
Type/Copy/Paste: sudo
-s nano /etc/profile or Type/Copy/Paste: sudo
-s gedit /etc/profile ,,,,,, Create a directory to hold the IBM Java SDK and JRE then we will move the downloaded IBM Java SDK and JRE, to /opt/ibm/java directory.
Then we will unpack the Java SDK and JRE. ,,,,,,, Use a text editor such as nano or gedit and edit the file.
Type/Copy/Paste: sudo
-s nano /etc/profile or Type/Copy/Paste: sudo
-s gedit /etc/profile ,,,, Also inform the system that IBM Java javac compiler must be the default compiler.
Type/Copy/Paste: sudo update-alternatives
--set java /opt/ibm/java/ibm-java-x86_64-70/bin/java Type/Copy/Paste: sudo update-alternatives
--set javaws /opt/ibm/java/ibm-java-x86_64-70/bin/javaws Type/Copy/Paste: sudo update-alternatives
--set javac /opt/ibm/java/ibm-java-x86_64-70/bin/javac ,, /etc/profile Note your system wide PATH /etc/profile file will reload after reboot of your Ubuntu Linux system ,,, Reboot your Ubuntu Linux system so that your system can reload the /etc/profile system wide PATH file.
Then you should be all set to run and develop IBM Java programs on your Ubuntu Linux system. -
Step 3: of all we will remove and disable other vendor versions of Java so there is no system conflict with multiple versions of Java.Let's assume you have OpenJDK installed on your system if so we are going to remove OpenJDK by issuing the following commands
-
Step 4: To remove OpenJDK from your system issue the following command: Type/Copy/Paste: sudo apt-get purge openjdk-\* This command will completely remove OpenJDK/JRE from your system
-
Step 5: Second
-
Step 6: we will disable Oracle Java if it is installed by editing the /etc/profile system PATH.In this exercise we will comment out the references to Oracle Java in the system wide /etc/profile file
-
Step 7: I also recommend deleting the Oracle Java folders if you have them so they do not cause system conflicts.For example if you have Oracle Java installed in /usr/local/java follow these instructions to remove Oracle Java Type/Copy/Paste: cd /usr/local/java Type/Copy/Paste: rm -rf jdk1.7.0 Type/Copy/Paste: rm -rf jre1.7.0
-
Step 8: If Oracle Java is installed on your system you will comment out the references to Oracle Java in the /etc/profile
-
Step 9: .profile or .bashrc file.
-
Step 10: For example
-
Step 11: as root
-
Step 12: use a text editor such as nano or gedit to edit your /etc/profile.
-
Step 13: You may have a file that looks like this: JAVA_HOME=/usr/local/java/jdk1.7.0 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin JRE_HOME=/usr/local/java/jre1.7.0 PATH=$PATH:$HOME/bin:$JRE_HOME/bin export JAVA_HOME export JRE_HOME export PATH
-
Step 14: You want to make sure you comment out the references to Oracle Java
-
Step 15: using the ## symbol in your /etc/profile
-
Step 16: .profile and .bashrc file so change the file to look like this: ##JAVA_HOME=/usr/local/java/jdk1.7.0 ##PATH=$PATH:$HOME/bin:$JAVA_HOME/bin ##JRE_HOME=/usr/local/java/jre1.7.0 ##PATH=$PATH:$HOME/bin:$JRE_HOME/bin ##export JAVA_HOME ##export JRE_HOME ##export PATH
-
Step 17: Save the /etc/profile file and exit
-
Step 18: Download the IBM Java 7.0 SDK and JRE Note in order to download IBM SDK/JRE you will have to be a registered user
-
Step 19: following the provided links from the IBM website in order to register.
-
Step 20: Download the version of IBM Java SDK and JRE for your system architecture
-
Step 21: in this case we are using the IBM Java SDK/JRE for 64 bit Ubuntu Linux
-
Step 22: which is: ibm-java-sdk-7.0-0.0-linux-x86_64.tgz ibm-java-jre-7.0-0.0-linux-x86_64.tgz
-
Step 23: Once the IBM Java SDK and JRE has been downloaded you will proceed to set up a development environment for the IBM JDK and JRE.
-
Step 24: Create a directory to hold the IBM Java SDK and JRE using the following command: Type/Copy/Paste: sudo -s mkdir -p /opt/ibm/java Type/Copy/Paste: chmod -R 755 /opt/ibm/java This makes the directory available to all users on the system
-
Step 25: Change into the download directory and copy the IBM Java SDK and JRE to /opt/ibm/java/ directory Type/Copy/Paste: cd /home/"your_user_name"/Downloads Type/Copy/Paste: sudo -s cp -r ibm-java-sdk-7.0-0.0-linux-x86_64.tgz /opt/ibm/java Type/Copy/Paste: sudo -s cp -r ibm-java-jre-7.0-0.0-linux-x86_64.tgz /opt/ibm/java
-
Step 26: Next change into your IBM Java directory Type/Copy/Paste: cd /opt/ibm/java
-
Step 27: Make the compressed IBM Java binaries executable for all users on the system by running the following commands: Type/Copy/Paste: sudo -s chmod a+x ibm-java-sdk-7.0-0.0-linux-x86_64.tgz Type/Copy/Paste: sudo -s chmod a+x ibm-java-jre-7.0-0.0-linux-x86_64.tgz
-
Step 28: Unpack the IBM Java SDK by issuing the following commands Type/Copy/Paste: sudo -s tar xvzf ibm-java-sdk-7.0-0.0-linux-x86_64.tgz Type/Copy/Paste: sudo -s tar xvzf ibm-java-jre-7.0-0.0-linux-x86_64.tgz
-
Step 29: The IBM SDK and the JRE will unpack into a single directory called: /opt/ibm/java/ibm-java-x86_64-70
-
Step 30: you need to edit the system wide PATH /etc/profile in order to create a system wide PATH for the IBM Java SDK/JRE on Ubuntu Linux.
-
Step 31: Enter the following information below: export PATH=${PATH}:/opt/ibm/java/ibm-java-x86_64-70/bin:/opt/ibm/java/ibm-java-x86_64-70/jre/bin:$PATH
-
Step 32: Save the file and exit
-
Step 33: inform the system that IBM Java SDK JRE is available Type/Copy/Paste: sudo update-alternatives --install "/usr/bin/java" "java" "/opt/ibm/java/ibm-java-x86_64-70/jre/bin/java" 1 Type/Copy/Paste: sudo update-alternatives --install "/usr/bin/java" "javaws" "/opt/ibm/java/ibm-java-x86_64-70/jre/bin/javaws" 1 Type/Copy/Paste: sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/ibm/java/ibm-java-x86_64-70/bin/javac" 1
-
Step 34: Inform your Ubuntu Linux system
-
Step 35: that IBM Java SDK/JRE must be the default Java.
-
Step 36: Also reload your system wide PATH /etc/profile by typing the following command:
-
Step 37: Type/Copy/Paste: .
-
Step 38: Test to see if IBM Java installed correctly by using the command: Type/Copy/Paste: java -version
-
Step 39: You should receive a message that displays: java version "1.7.0-ea" Java(TM) SE Runtime Environment (build pxa6470-20100531_04)IBM J9 VM(build2.6
-
Step 40: JRE 1.7.0 IBM J9 2.6 Linux amd64-64 jvmxa6470-20100522_58582 (JIT enabled
-
Step 41: AOT enabled) J9VM - R26_head_20100521_1457_B58494 JIT dev_20100507_15747 GC - R26_head_20100521_1652_B58499 J9CL - 20100522_58582) JCL - 20100514_02 based on Sun 7b76
-
Step 42: Test that your IBM Java compiler works by using the command: Type/Copy/Paste: javac -version You should receive a message that displays: javac 1.7.0-internal You can also switch between different installed vendors of Java
-
Step 43: such as OpenJDK
-
Step 44: Oracle and IBM by using the command: Type/Copy/Paste: sudo update-alternatives --config java Make sure you select the Java directory which references IBM Java and press enter.
Detailed Guide
You can check which vendor version of Java you have on your system by running the following commands:
Type/Copy/Paste: java
-version Type/Copy/Paste: javac
-version Make note of your vendor version of Java
,,,,,,,, If you have references to the Oracle Java JDK/JRE in those files comment them out using the ## symbol.
Type/Copy/Paste: sudo
-s nano /etc/profile or Type/Copy/Paste: sudo
-s gedit /etc/profile ,,,,,, Create a directory to hold the IBM Java SDK and JRE then we will move the downloaded IBM Java SDK and JRE, to /opt/ibm/java directory.
Then we will unpack the Java SDK and JRE. ,,,,,,, Use a text editor such as nano or gedit and edit the file.
Type/Copy/Paste: sudo
-s nano /etc/profile or Type/Copy/Paste: sudo
-s gedit /etc/profile ,,,, Also inform the system that IBM Java javac compiler must be the default compiler.
Type/Copy/Paste: sudo update-alternatives
--set java /opt/ibm/java/ibm-java-x86_64-70/bin/java Type/Copy/Paste: sudo update-alternatives
--set javaws /opt/ibm/java/ibm-java-x86_64-70/bin/javaws Type/Copy/Paste: sudo update-alternatives
--set javac /opt/ibm/java/ibm-java-x86_64-70/bin/javac ,, /etc/profile Note your system wide PATH /etc/profile file will reload after reboot of your Ubuntu Linux system ,,, Reboot your Ubuntu Linux system so that your system can reload the /etc/profile system wide PATH file.
Then you should be all set to run and develop IBM Java programs on your Ubuntu Linux system.
About the Author
Deborah Clark
Dedicated to helping readers learn new skills in crafts and beyond.
Rate This Guide
How helpful was this guide? Click to rate: