Pages

Sunday, February 28, 2016

JAVA JDK installation on UBUNTU OS on Beaglebone Black [BBB]

This time i have tried installing JAVA JDK on UBUNTU OS which is running on Beagle Bone Black [BBB]. Installation is pretty much simple but the right selection of JAVA JDK variant (architecture) is very much important. In this process, i have tried installing various version of JAVA JDKs but i have succeeded only in one variant of JDK. i.e. ejre-7u45-fcs-b15-linux-arm-vfp-hflt-server_headless-26_sep_2013.tar.gz Download and installation steps are provided below.

Download

Go to Oracle website and download the variant ejre-7u45-fcs-b15-linux-arm-vfp-hflt-server_headless-26_sep_2013.tar.gz. Make sure that you are agreeing the oracle terms and condition to download the software.

Install

Copy the files to the directory where you want to keep the java file. In my case i have copied the files into /opt/.

Some times installation requires root privileges, So login as root user otherwise use sudo before the each command execution.

Create directory as jdk in /opt/ directory

mkdir /opt/jdk

Extract the compressed file into the targeted directory

tar -zxvf ejre-7u45-fcs-b15-linux-arm-vfp-hflt-server_headless-26_sep_2013.tar.gz -C /opt/jdk

Verify the extract location

ls /opt/jdk


Environment Settings

This has to be done to tell the OS to point java execution to extracted directory.

Edit the file to add the java installation path (root privileges required).

nano /etc/profile

Add below lines of code into the file and save.

export JAVA_HOME=/opt/jdk/ejre1.7.0_45
export PATH=$PATH:/opt/jdk/ejre1.7.0_45/bin

Save it by pressing shortcut keys.

Ctrl+x
y
Enter

Verify

Execute this command in any terminal. it should returns the version of the java installed.

java -version

Output will be

java version "1.7.0_45"
Java(TM) SE Embedded Runtime Environment (build 1.7.0_45-b15, headless)
Java HotSpot(TM) Embedded Server VM (build 24.45-b08, mixed mode)


Troubleshoot

If you get the error as java command not found then the environment setting is not properly done.

If you get the error as no such file or directory then the selection of JAVA is not correct. Revisit the java variants supported for your OS and Hardware.