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...

44 Steps 2 min read Advanced

Step-by-Step Guide

  1. 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
  2. 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.
  3. 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

  4. 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

  5. Step 5: Second

  6. 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

  7. 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

  8. Step 8: If Oracle Java is installed on your system you will comment out the references to Oracle Java in the /etc/profile

  9. Step 9: .profile or .bashrc file.

  10. Step 10: For example

  11. Step 11: as root

  12. Step 12: use a text editor such as nano or gedit to edit your /etc/profile.

  13. 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

  14. Step 14: You want to make sure you comment out the references to Oracle Java

  15. Step 15: using the ## symbol in your /etc/profile

  16. 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

  17. Step 17: Save the /etc/profile file and exit

  18. 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

  19. Step 19: following the provided links from the IBM website in order to register.

  20. Step 20: Download the version of IBM Java SDK and JRE for your system architecture

  21. Step 21: in this case we are using the IBM Java SDK/JRE for 64 bit Ubuntu Linux

  22. 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

  23. 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.

  24. 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

  25. 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

  26. Step 26: Next change into your IBM Java directory Type/Copy/Paste: cd /opt/ibm/java

  27. 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

  28. 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

  29. Step 29: The IBM SDK and the JRE will unpack into a single directory called: /opt/ibm/java/ibm-java-x86_64-70

  30. 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.

  31. 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

  32. Step 32: Save the file and exit

  33. 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

  34. Step 34: Inform your Ubuntu Linux system

  35. Step 35: that IBM Java SDK/JRE must be the default Java.

  36. Step 36: Also reload your system wide PATH /etc/profile by typing the following command:

  37. Step 37: Type/Copy/Paste: .

  38. Step 38: Test to see if IBM Java installed correctly by using the command: Type/Copy/Paste: java -version

  39. 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

  40. Step 40: JRE 1.7.0 IBM J9 2.6 Linux amd64-64 jvmxa6470-20100522_58582 (JIT enabled

  41. 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

  42. 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

  43. Step 43: such as OpenJDK

  44. 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

D

Deborah Clark

Dedicated to helping readers learn new skills in crafts and beyond.

39 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: