Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have ubuntu 12.04 LTS version 64 bit . what is the procedure for installing and running Java for development purpose. I am new to Linux and Unix platform. Thanks in advance

share|improve this question
possibly duplicated… – yuan Dec 31 '12 at 6:33
Possible duplicate :… – owl Dec 31 '12 at 6:36
Linux is not necessarily UNIX. – owl Dec 31 '12 at 6:38

On the command line, type:

$ sudo apt-get install openjdk-7-jre


1) Goto 2) Download the 64-bit package.


Change to the directory in which you want to install. Type:

cd <directory path name>

For example, to install the software in the /usr/java/ directory, Type:

cd /usr/java/

Note about root access: To install Java in a system-wide location such as /usr/local, you must login as the root user to gain the necessary permissions. If you do not have root access, install Java in your home directory or a subdirectory for which you have write permissions. Move the .tar.gz archive binary to the current directory.

Unpack the tarball and install Java:

tar zxvf jre-7u7-linux-x64.tar.gz

The Java files are installed in a directory called jre1.7.0_07 in the current directory. In this example, it is installed in the /usr/java/jre1.7.0_07 directory. When the installation has completed, you will see the word Done. Delete the .tar.gz file if you want to save disk space.

share|improve this answer
thanks and how do I specify the path and class-path ? – grv.giit Dec 31 '12 at 6:40
1… will help. Scroll down to "Linux" section. – owl Dec 31 '12 at 6:43
IMO, you are better off with the Oracle JDK rather than OpenJDK as when I used OpenJDK, I could not launch for example AndroidStudio as it checks if your using it and warns you not to. Minecraft game also recommends not to use it as it isn't supported. Most things will work fine with it but some apps check for it and block you even trying. – brim4brim May 27 '13 at 0:02
" When the installation has completed, you will see the word Done. " - umm, what? No. There is no "installation" done, only unpacking. Java isn't installed after this.. – Blauhirn Mar 7 at 14:47

If you are connected to internet then just click on the "Ubuntu Software Center" and type Java in the search box, you will find Java IDE's in result. choose one that you were looking and select Install.

share|improve this answer
Please find edited post. Thanks! – VRU Dec 31 '12 at 6:44
thanks veerendar !! – grv.giit Dec 31 '12 at 6:48

For me it's much easier to install it from software center, just go to development category java already there, Click to read more information i recommend you, if you need special kind of java, because ubuntu offers an Open JDK

share|improve this answer
Not if it's CLI it's not (which is the case here). – cybermonkey Oct 21 '15 at 22:52

If you have internet connected then just do-

sudo apt-get install default-jdk

That will do the work for you...

share|improve this answer
yes ,it works everytime..the latest stable java release is dont have to worry about version number..its better...@UserName22 – pranav Oct 30 '15 at 7:59
This doesn't install the 64-bit version which was the issue the OP had. – Mike Bethany Jun 15 at 9:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.