From Notes Wiki
Jump to: navigation, search
Home > Ubuntu > Installing Java on Ubuntu 12.04 x86 64 Desktop

Installing Java on Ubuntu 12.04 x86 64 Desktop

To install Java on Ubuntu 12.04 x86_64 Desktop use following steps:

  1. Download java-sdk with netbeans from http://www.oracle.com/technetwork/java/javase/downloads/index.html Download .sh file.
  2. Give execute permissions to .sh file using 'chmod +x jdk-7u40-nb-7_3_1-linux-x64.sh'. In this and all future steps replace the version of java and netbeans with the version of java and netbeans downloaded appropriately.
  3. Execute setup using 'sudo jdk-7u40-nb-7_3_1-linux-x64.sh' or similar command based on version downloaded.
  4. Choose to install both jdk and netbeans in '/opt/jdk1.7.0_40' and '/opt/netbeans-7.3.1' etc. instead of installing in '/usr/local'. Again name of folders inside opt may differ based on java and netbeans versions.
  5. Check for currently installed java versions using 'java' command. If some other java is already installed, uninstall it using package managers.
  6. Edit file '/etc/bash.bashrc' and append following lines at the end:
    JAVA_HOME=/opt/jdk1.7.0_40
    JRE_HOME=/opt/jdk1.7.0_40/jre
    PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
  7. Open a new terminal and verify that oracle java installed in /opt has highest priority using 'which java'.