4/22/2016

PINE64: install Oracle JDK 8

This post show how to install Oracle JDK 8 on PINE64.

  1. Download jdk-8u77-linux-arm64-vfp-hflt.tar.gz from Oracle
  2. Extract the downloaded file to /opt
    $ sudo tar zxvf jdk-8u77-linux-arm64-vfp-hflt.tar.gz -C /opt
  3. Set default java and javac to the extracted JDK 8
    $ sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_77/bin/javac 1
    $ sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_77/bin/java 1
  4. If you already installed the other JDK like openjdk, update the configuration
    $ sudo update-alternatives --config javac
    $ sudo update-alternatives --config java
  5. Check the commands
    $ java -version
    $ javac -version
  6. This is a sample code of Sample.java
    public class Sample {
      public static void main(String[] args) {
        System.out.println("Java world on PINE64!!");
      }
    }
    
  7. Compile the code and run
    $ javac Sample.java
    $ java Sample

No comments:

Post a Comment