Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have been trying to get Java for the past day now. I followed several tutorials but I keep getting the same error. After I put in tar -xvf jre-7u4-linux-i586.tar.gz it says Cannot open: No such file or directory tar: Error is not recoverable: exiting now

I have a 64 bit system so I doubt that's the problem. The JDK installed perfectly, but I'm lost as to why the JRE wont work...

share|improve this question
3  
You say that you have a 64-bit system, but the package says 1586. Make sure you have the right version. –  Dymatic May 13 '12 at 3:53
    
If you install the JDK, that typically includes the JRE as well. –  izx May 13 '12 at 5:09
1  
Did you actually download that file? –  Thorbjørn Ravn Andersen May 16 '12 at 13:14
    
And where do you write it? It needs to be in a terminal window. –  Thorbjørn Ravn Andersen Jun 26 '12 at 12:21

8 Answers 8

If OpenJDK isn't preferred, you can install the Oracle version from a ppa (which is a lot easier than manual installation, and you should also receive updates automatically). Adding via ppa also ensures that you are using the correct architecture (32 vs 64 bit).

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java7-installer

Source: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

share|improve this answer
    
"add-apt-repository" command doesn't exist o_O –  knocte Sep 21 '12 at 11:14
1  
knocte - had that same issue. RTFG says you need to install python-software-properties or add it to /etc/apt/sources.list manually. –  lonstar Sep 22 '12 at 14:01
    
The best way for now. –  Shiki Apr 25 '13 at 8:29

The simplest way to get Java installed with Ubuntu 12.04 is to run

sudo apt-get install default-jdk

Do not mess with downloading any files - just use the package manager.

share|improve this answer
1  
That'll give you OpenJDK, which isn't compatible with ANYTHING. –  fiXedd Aug 31 '12 at 15:04
    
@fiXedd Either you don't know what you are talking about and then perhaps you should not comment, or you do know what you are talking about, and then you should know better. –  Thorbjørn Ravn Andersen Aug 31 '12 at 17:51
    
I should know better :) Seriously though... quite a few things won't work with OpenJDK (or are subtly buggy). –  fiXedd Sep 5 '12 at 20:05

This set of instructions is for 64bit Java installation

Download Java to the Downloads folder

1 - Open Terminal, copy & paste the following commands

sudo mkdir -p -v /opt/java/64

Press Enter

cd Downloads && tar xvzf ~/Downloads/jre-7u4-linux-x64.tar.gz

Press Enter

sudo mv -v ~/Downloads/jre1.7.0_04 /opt/java/64

Press Enter

sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/64/jre1.7.0_04/bin/java" 1

Press Enter

sudo update-alternatives --set java /opt/java/64/jre1.7.0_04/bin/java

Press Enter

mkdir -v ~/.mozilla/plugins 

Press Enter

Now remove the IcedTea plugin, if it has been installed. If it's not there to begin with, you'll see a notification of that.

sudo apt-get remove icedtea6-plugin

Press Enter

Remove a former version of the Java plugin (may or may not be present, run the command just to make sure). If it's not there to begin with, you'll see a notification of that.

rm -v ~/.mozilla/plugins/libnpjp2.so

Press Enter

ln -s /opt/java/64/jre1.7.0_04/lib/amd64/libnpjp2.so ~/.mozilla/plugins/

Press Enter

These instructions were copied verbatim from the Easy Linux Tips Project

I have used these instructions myself and can verify that they do work.

Easy Linux Tips - Installing Oracle Java

share|improve this answer
    
This is good but OP states they are using a 64 bit system. Can you update your answer to also include the x64 instructions? –  amc May 16 '12 at 12:56
1  
Or you can install it using PPA sudo add-apt-repository ppa:webupd8team/java and let the installer handle all the hassle mentioned in the above answer. But its better to be aware with "long-cut" before you opt-in for "short-cut" ;-) –  Kush May 16 '12 at 13:12
    
@Kush I was just adding that ppa info as an answer –  amc May 16 '12 at 13:21
    
@amc: The answer I commented fulfills the need anyway, PPA is just easier way to work out the same :-) –  Kush May 16 '12 at 13:24

Open Software Center and type jre there.

java

share|improve this answer
    
I don't have sure about version 7, but in 6, JRE from OpenJDK and Sun are different, for example, the VPN application I use in my company doesn't work with OpenJDK, just with JRE from Sun. –  Pipe May 16 '12 at 13:04

I had the same problem with a friends machine, all i did was to install the openjdk, this can be done using the below command

sudo apt-get install openjdk-7-oracle

The above command work in 12.04, but to previous version you either add some ppa, or just run the below command

sudo apt-get install openjdk-6-jdk

It worked for me and my friend.

Hope that helped.

share|improve this answer

For 64 bit i've tested and woked on before.

Those are the steps i did before:

Download the sun jre 7 tar file from here

Extract the tar file:

tar -xvzf jre-7u4-linux-x64.tar.gz

Move extracted folder to this location:

sudo mv jre1.7.0_04 /usr/lib/jvm/

Install new java source in system:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.7.0_04/bin/java 1

Choose default java:

sudo update-alternatives --config java

java version test:

java -version

Verify the symlinks all point to the new java location:

ls -la /etc/alternatives/java*

For 32bit architecture see this link

share|improve this answer

This guy and myself need Sun JAVA specifically as many things do not run on openJDK thus people will ask about Sun Java, openJDK is not useless just it is behind Sun Java as Sun Java will always be a little ahead as it has more support.

So for the people that need SUN JAVA (Oracle) here is what I did: I found these commands got me up and running.

I feel sorry for the people that just want the solution but its really getting bad that people give a solution without reading or knowing what they are talking about.

I had the same problem and found that 3 sites fixed my issue and I hope this helps.

I installed ubuntu 12.04 Server 64bit. Hardware specs
Intel Xeon E5-2620 on Intel S2600CP2
Host OS Vmware ESXI 5.0
Guest ubuntu 12.04 Server 64bit

And I logged in. I typed the following commands to get Java 7 64bit installed.

sudo apt-get install python-software-properties << i believe this installs the apt-get-repository scripts.

sudo apt-get update <<< updates the software list

sudo apt-get upgrade <<< updates and installs software from list.

sudo apt-get dist-upgrade <<< upgrades version of ubuntu server example 11.05 to 12.01

sudo reboot <<< reboot is a must.

sudo add-apt-repository ppa:webupd8team/java <<< adds repository for Oracle Java

sudo apt-get update <<< refresh list

sudo apt-get install oracle-java7-installer << install Java

java -version <<< checks java version installed.

You should get JAVA(TM) 64bit version

I hope this helps.

share|improve this answer

OpenJDK Java is a wise option, better though. But if you still insist on Oracle Java, then please download jre-7u4-linux-x64.tar.gz file from their site and do the same operations . It will do the job.

share|improve this answer

Your Answer

 
discard

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.