Wednesday, January 8, 2020

Install JDK on Ubuntu 32 bit and 64 bit




To install JDK on Ubuntu we need to do several step. Basically this tutorial for 32-bit and 64-bit Oracle Java 8 JDK on 32-bit and 64-bit Ubuntu operating systems. These instructions will also work on Debian and Linux Mint

1.  Go to terminal and type /sbin/init, this command to check your Ubuntu architecture weather it's 32 or 64 bit.

2. Check Java installed, type java-version on your terminal. If you have OpenJDK installed on your system it will give this results:

  • java version "1.7.0_60"
    OpenJDK Runtime Environment (IcedTea6 1.10pre) (7b15~pre1-0lucid1)
    OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode) 
Remembered that OpenJDK is not same with JDK.

3. Remove OpenJDK/JRE from your system by running this command: sudo apt-get purge openjdk-\* 

4. Download JDK from Download JDK .Please Remember to download JDK version which fits with your architecture system. For example, if your system running on 32 Bit download 32 Bit Oracle Java binaries.


5.After finished download the JDK file, copy your JDK file to '/usr/local/java'.

   sudo cp -r your-java-binaries /usr/local/java/ 

6.Go to '/usr/local/java/'. cd /usr/local/java/

7. Unpack The Java Binaries in /usr/local/java. Type sudo tar your-java-binaries

8. Your java/ folder will contain jdk and jre directory.


9. Edit system path file.

  • sudo gedit /etc/profile
  • Scroll down until end of file and type:
         JAVA_HOME=/usr/local/java/your-jdk-directory
         PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
         export JAVA_HOME
         export PATH
  • Save and exit
10. Inform your system where your Oracle Java JDK/JRE is located
  • sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/your-jdk-directory/bin/java" 1
  • sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/your-jdk-directory/bin/javac" 1
  • sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/your-jdk-directory/bin/javaws" 1 
 11. Inform your system Oracle Java JDK/JRE must default
  • sudo update-alternatives --set java /usr/local/java/your-jdk-directory/bin/java  
  • sudo update-alternatives --set javac /usr/local/java/your-jdk-directory/bin/javac 
  • sudo update-alternatives --set javaws /usr/local/java/your-jdk-directory/bin/javaws
12. Reload your system wide PATH /etc/profile by typing source /etc/profile
13. Test by run java -version  
  • If your instalation is correct, in terminal will displaying something like this:
          java version "1.8.0_05"
         Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
         Java HotSpot(TM) Server VM (build 24.51-b03, mixed mode) 

 
14. Test your javac by run javac -version
  • You should receive a message which displaying something like this: javac 1.8.0_05 
15.Reboot Your System.
Share:

0 comments:

Post a Comment