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

This question already has an answer here:

After downloading jdk-7u45-linux-x64.tar.gz and moving it to my own folder ~/java, I followed their steps here:

I apparently only extracted the contents of the file, because when I ran this command:

% tar zxvf jdk-7u45-linux-x64.tar.gz

It said that it couldn't find the % command, so I removed % and ran it, then when I typed java, it output to me what it did when I first installed Ubuntu. What am I doing wrong?

share|improve this question

marked as duplicate by bain, Alaa Ali, Luis Alvarado Aug 4 '14 at 22:15

This question was marked as an exact duplicate of an existing question.

Did you try this:… – i08in Dec 17 '13 at 3:47

Here are detailed instructions that I generally agree with. You can skip Step 6.

How to Install Oracle Java JDK on Ubuntu Linux

share|improve this answer

The command sudo apt-get install openjdk-7-jdk should do the job. If there is a dependency problem run sudo apt-get -f install and rerun the earlier command.

share|improve this answer

Try this step by step and it will work: Good luck

share|improve this answer

The actual command is "tar zxvf jdk-7u45-linux-x64.tar.gz", without "%". But that will only extract the JDK archive and won't install it.

It's a bit tricky to install JDK properly manually but you can easily do it by using an automated installer - all you have to do to download and install the latest Oracle JDK 7 is to use the commands below:

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

More info: Install Oracle Java 7 in Ubuntu via PPA Repository

share|improve this answer

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