Skip to content

Jesses Software Engineering Blog

Apr 10

Jesse

Java JDK8 Install

Java is a common language in both the professional and academic realm, and a valuable language to know. Unlike PHP, Python, or Ruby, Java is a compiled language which gives it some unique performance advantages. Java is also the language used when developing Android apps and is essential to mobile development. Taking the time to get familiar with Java syntax, libraries, and organization is a valuable programming experience.

Fedora 20 Install:

  1. Download source – This example installs using the tar file
    wget --no-check-certificate --no-cookies - --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz
    
  2. Install
    mv ~/Downloads/jdk-8-linux-x64.tar.gz /usr/lib/jvm/jdk-8-linux-x64.tar.gz
    tar -xzf jdk-8-linux-x64.tar.gz
    
    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0/bin/java 0
    sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0/bin/javac 0
    sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.8.0/bin/javaws 0
    
  3. Verify installation
    java -version
    
  4. Set Java environment vars in ~/.bashrc
    export JAVA_HOME=/usr/lib/jvm/jdk1.8.0/
    export JRE_HOME=/usr/lib/jvm/jdk1.8.0/jre
    export PATH=$PATH:/usr/lib/jvm/jdk1.8.0/bin:usr/lib/jvm/jdk1.8.0/jre/bin
    
    # reload
    source ~/.bashrc
    
  5. Create test program
    vi helloworld.java
    
    class helloworld 
    {
        public static void main(String[] args) 
        {
            System.out.println("HELLO WORLD");
        }
    }
    
  6. Compile and run
    javac helloworld.java
    java  helloworld
    
  7. Install a Java IDE like Eclipse or Netbeans. Download Eclipse
    tar -xvzf eclipse-java-kepler-SR2-linux-gtk-x86_64.tar.gz
    

Ubuntu 14.04 Install:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

Blog Powered By Wordpress