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.

Possible Duplicate:
How do I install Java?

I want to install jre-7u5-linux-x64 on Ubuntu 12.04

marwa@marwa-Vostro-1540:~$ sudo apt-get install  
[sudo] password for marwa: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package jre1.7.0_05
E: Couldn't find any package by regex 'jre1.7.0_05'

marwa@marwa-Vostro-1540:~$ sudo gedit etc/apt/sources.list

But the gedit is empty, what i can do?

And what is the meaning of :

Reading package lists... Done`
Building dependency tree
Reading state information... Done
E: Unable to locate package jre1.7.0_05
E: Couldn't find any package by regex 'jre1.7.0_05'
share|improve this question
add comment

marked as duplicate by Jorge Castro, devav2, Mitch, maythux, jokerdino Oct 11 '12 at 5:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4 Answers

Most things will work fine with OpenJDK7 but if you are running into one of the exceptions the easiest way to install JRE7 is:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

The page that gives detailed instructions is Here.

Source: http://www.webupd8.org

Quote from source page:

If you really need to use Oracle (ex Sun) Java instead of OpenJDK in Ubuntu, here's an easy way to do it: a PPA repository to install and keep your computer up to date with the latest Oracle Java 7 (Java JDK which includes JRE).

The PPA installed with the above command does not actually contain Oracle Java. ** Oracle licenses no longer allow Java to be redistributed.** This PPA works by connecting to Oracles official download server and downloads the file, it is then installed by apt-get or can be installed by the Ubuntu Software Center. It works the same way that the Flash Pluging installer works. Here is what the PPA manager(which is also the soure of these directions, see this link(same link as above)) here is some more of the page pasted here.

Oracle JDK7 itself is not hosted in the PPA because that's not allowed by the new Java license (which is also the reason why it has been removed from the official Ubuntu repositories); the package in the PPA automatically downloads (and installs) Oracle Java JDK 7 from its official website and installs it on your computer, just like the flashplugin-installer package does.

share|improve this answer
    
i did what u say that i use –  marwa Jul 17 '12 at 0:03
    
what u say but i have these lines in terminal Connecting to download.oracle.com (download.oracle.com)|62.41.4.202|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 81439763 (78M) [application/x-gzip] Saving to: `jdk-7u5-linux-x64.tar.gz' 0K ........ . ........'' so what should i do after that &what ok mean???? –  marwa Jul 17 '12 at 0:05
    
I edited my answer to better explain, I don't want to cut and paste any more from the source website, I may end up using more that would be allowed, so if you still need more information please check the link I provided. I am not trying to be arrogant here, but I don't want to plagiarize webup8.org, or otherwise take credit for their work, so my best option is to refer you to their page if I have not been clear enough. –  TrailRider Jul 17 '12 at 1:09
    
sorry it forgot to include this in my last comment, the "OK ... ..." is just a progress bar for the download so that you know that is it still running and it will give you occasional size updates as well. "......... 20kb" ".......30kb""....40kb" , until it has completely downloaded. –  TrailRider Jul 17 '12 at 1:14
add comment

sudo gedit etc/apt/sources.list

This command is wrong. The file path should begin with "/":

sudo gedit /etc/apt/sources.list

If you need java (jre or jdk), you can install it using user827992's answer or using Ubuntu software center, typing "java" in the search box, select the package and click "Install": ubuntu software center 12.04 java jre

share|improve this answer
add comment

First be sure that your apt cache is up to date with

sudo apt-get update

If you want to search a package with a particular word in it like jre, just run

apt-cache search jre

in a terminal to get the list of all the available packages in the repository.

You can install the package that you want with

sudo apt-get install packageName
share|improve this answer
add comment

To install java in your machine follow these steps. This documentation cover installation and enabling java for browser. Download jre-7u5-linux-x64 from here. Put it in Downloads folder.

Open a terminal. Copy/Paste

Remove any perior installation of java.

sudo apt-get purge openjdk-\*

Make directory in /usr/local/java where this software will install.

sudo mkdir -p /usr/local/java

Now copy jre-7u5-linux-x64.tar.gz into /usr/local/java directory.

cd ~/Downloads

sudo -s cp -r jre-7u5-linux-x64.tar.gz /usr/local/java

Now change directory to*/usr/local/java*

cd /usr/local/java

Change your file permission and extract by typing

sudo -s chmod a+x jre-7u5-linux-x64.tar.gz

sudo -s tar xvzf jre-7u5-linux-x64.tar.gz

Now open /etc/profile file

sudo gedit /etc/profile and copy paste below text at the last of the recent opened file.

JAVA_HOME=/usr/local/java/jdk1.7.0_05

PATH=$PATH:$HOME/bin:$JAVA_HOME/bin

JAVA_HOME=/usr/local/java/jre1.7.0_05

PATH=$PATH:$HOME/bin:$JAVA_HOME/bin

export JAVA_HOME

export PATH

Now tell your system that you have newly java installed and use it from my installed directory.

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.7.0_05/bin/java" 1

sudo update-alternatives --set java /usr/local/java/jre1.7.0_05/bin/java

Reload system profile so that it can use java.

. /etc/profile

Now reboot your system.

Verify that your java is working in here

Now install java plugin for you browser (Firefox & Chrome).

Chrome

cd /opt/google/chrome/plugins

sudo ln -s /usr/local/java/jre1.7.0_05/lib/i386/libnpjp2.so

Firefox

sudo mkdir -p /usr/lib/mozilla/plugins

cd /usr/lib/mozilla/plugins

sudo ln -s /usr/local/java/jre1.7.0_05/lib/i386/libnpjp2.so

java -version this will give you what java do you have.

share|improve this answer
add comment

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