Skip to main content

Install Java using binary distributions in Ubuntu

 

 Why we should use Binary Installation without using apt in Ubuntu?

The difference is that apt installs generic binaries and manages their versions.
When compiling a source package you are entirely on your own because apt cannot manage the package.

However, compiling a source package and installing it yourself is useful if you need features that can be had only by compiling the package yourself.
Sometimes developers will provide features that can only be used in software if a certain compiler switch is used. And sometimes specific processors can perform better if certain compile flags are used.
 
However, in most cases the features that can be enabled are for debugging purposes and will never be needed even by hard core users. And the binary version that apt is configured to use is already optimized for your processor.
Possible situations where you would need to compile the source yourself would be:
  • There's a version of the software available that has features or fixes you need but the package hasn't been updated in your repository yet.
  • You're compiling the software to use on a computer with a different architecture.

How to install JDK using Binary distribution in Ubuntu?


Download the x64 tar.gz on the Oracle Downloads page.

Create a directory and move the file there

sudo mkdir ~/jdk 
cd ~/jdk 
sudo mv ~/Downloads/jdk-8u45-linux-x64.tar.gz .
 
And unpack it

sudo tar zxvf jdk-8u45-linux-x64.tar.gz
 
You have just extracted the binary file but you didn't set JAVA_HOME.

First set the JAVA_HOME in your profile i.e. in ~/.bashrc file.

export JAVA_HOME=~/jdk/java/jdk1.8.0_45
export PATH=$PATH:$JAVA_HOME/bin

However, compiling a source package and installing it yourself is useful if you need features that can be had only by compiling the package yourself.

You can check the java version to double check by typing the command java -version.




And you can install multiple Java versions in your device and set up aliases to quickly switch between the versions. Please refer to my article on Swap JDK using aliases in Ubuntu.

Hope you learned something from this article. Thank you.

Comments

Popular posts from this blog

Gitlab SSO implementation using Keycloak

  Prerequisites  Keycloak server should be up and running  By default Keycloak will start on http://localhost:8180 To install and configure Keycloak visit www.keycloak.org/docs/latest/getting_started/index.html. Gitlab must be installed locally By default Gitlab starts on http://localhost:3000 To install and configure Gitlab visit https://docs.gitlab.com/omnibus/manual_install.html Environment Gitlab Installed package - gitlab-ce_11.1.4-ce.0_amd64.deb (Omnibus package) Keycloak version - Version 4.2.1.Finalhttps://github.com/ChathuminaVimukthi/Gitlab-SSO-implementation-using-Keycloak SSO Configuration GitLab can be configured to act as a SAML 2.0 Service Provider (SP). This allows GitLab to consume assertions from a SAML 2.0 Identity Provider (IdP) to authenticate users. For this SSO implementation, Gitlab omnibus package is used. But the source package can be used as well. The configuration for the source packge is available on https:/...

Binary vs. Source Packages

Regardless of the  package manager  you’re using, you have two ways of installing programs on Linux. You either use a pre-built package, or compile it yourself. These days, the former usually wins out by default. There are, however, times when you should consider the alternative. What Are Binary Packages? Installing programs on Linux is usually quite different to installing on Windows. Rather than get the installers off a vendor’s website, the files are retrieved from a repository of programs, usually  tailored  for your operating system. Files for separate programs are stored in an  archive format . This bundles everything into a single file for easy access later. For example, Debian uses the DEB format to store their programs. These bundles are called  binary packages . Installing requires a special program to extract these files and put them onto your computer. That is to say, your package manager (e.g. APT, Yum, and so on). It also doe...

Python vs AI

WHAT IS AI? From SIRI to self-driving cars, artificial intelligence (AI) is progressing rapidly. While science fiction often portrays AI as robots with human-like characteristics, AI can encompass anything from Google’s search algorithms to IBM’s Watson to autonomous weapons. WHY PYTHON FOR AI? Artificial intelligence today is properly known as narrow AI (or weak AI), in that it is designed to perform a narrow task (e.g. only facial recognition or only internet searches or only driving a car). However, the long-term goal of many researchers is to create general AI (AGI or strong AI). While narrow AI may outperform humans at whatever its specific task is, like playing chess or solving equations, AGI would outperform humans at nearly every cognitive task. For many years, we used Lisp, because it handled lists and trees really well, had garbage collection, and didn’t require type declarations. ...