The new Raspbian come with java 1.8.0 with path set, but no JAVA_HOME.
If you need set JAVA_HOME for the preload java in new Raspbian, refer to my updated post "Set JAVA_HOME for Raspbian pre-loaded java 1.8.0".
This post show how to download JDK 8 on a host computer running Ubuntu Linux (not on Raspberry Pi), then copy to Raspberry Pi, ssh to Pi to setup JDK 8 and set JAVA_HOME and PATH in .bashrc.
To download JDK 8 on a host computer, visit: http://www.oracle.com/technetwork/java/javase/downloads/index.html, follow the steps to download Java SE Development Kit (JDK) for ARM.
In the following steps,
- jdk-8u6-linux-arm-vfp-hflt.tar.gz is the downloaded file
- 192.168.1.104 is the IP address of Raspberry Pi
- pi is the user in Raspberry Pi
Run the command to copy the downloaded file to Raspberry Pi:
$ scp jdk-8u6-linux-arm-vfp-hflt.tar.gz email@example.com:
Log-in Raspberry Pi via ssh:
$ ssh -X 192.168.1.104 -l pi
(-X is option)
Un-pack the file to /opt
$ sudo tar -zxvf jdk-8u6-linux-arm-vfp-hflt.tar.gz -C /opt
Edit .bashrc, to set JAVA_HOME and PATH:
$ nano .bashrc
Add the two line
where /opt/jdk1.8.0_06 is the unpacked folder of the new JDK.
Finally reboot Raspberry Pi.
- Try demo of Java SE 8 for ARM on Raspberry Pi