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

New to ubuntu, I have just installed the OS in my VMPlayer. I am trying to install Oracle (Sun) Java 6 onto my Ubuntu 13.

As per the instruction given here I download jdk-6u45-linux-x64.bin from the official site. Followed further instructions of chmod as give in the link. But the unpacking step fails with the following error :

./install.sfx.29727: 1: ./install.sfx.29727: ELF: not found
./install.sfx.29727: 2: ./install.sfx.29727: Syntax error: ")" unexpected
Failed to extract the files.  Please refer to the Troubleshooting section of
the Installation Instructions on the download page for more information.

And a failed encoding file is created in the pwd.

@@@�@8@@@@@@����@�@@@������@�@ (invalid encoding)

I am not able to understand the error messages or the issue at hand. Please advice. How can I install java onto my system

share|improve this question
Easiest way to install Oracle Java is using a PPA. It's all prepackaged for you there. Why were you installing manually? Also note that there's OpenJDK - a free alternative to Oracle's. I would recommend using Oracle's only if you really need to - use OpenJDK if possible (in official repository). – gertvdijk Jun 26 '13 at 12:18
i didn't know any other methods of installation. Plus the fact that every search result for install java ubuntu lead me to openjdk installations procedures, I tried the manual install – Rickesh John Jun 26 '13 at 12:25
Sorry, I don't get what you mean. "All solutions describe OpenJDK packages, so I try manual Oracle JDK installer"? That does not make sense. Also read the page you linked yourself - it's giving this PPA as the first option for Oracle's JDK and explains why. – gertvdijk Jun 26 '13 at 12:29
Oh!!! my bad!! I guess didn't notice the superuser link.. :) – Rickesh John Jun 26 '13 at 12:39
Does he really need Oracle java or may be he don't know what OpenJDK is? – Barafu Albino Jun 27 '13 at 12:49
up vote 0 down vote accepted

First, Java SE 6 is archived, so please use 7 instead.

Personally I prefer to use the tar.gz package to manually install Java SE.


For example the latest => jdk-7u25-linux-x64.tar.gz

Just extract it to somewhere,for example /opt/jdk1.7.0_25, set proper mode for the directory, write a script to set up java


#Set JDK for all users

when you need to use java, just . or source

You can add it to your ~/.bash_profile (Ubuntu doesn't have this by default), so do it in ~/.profile instead. You can do it for all users (system wide), up to you.

If you have multiple java versions, use update-alternatives to install / config.

update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.7.0_25/bin/java" 1 update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.7.0_25/jre/bin/java" 2

Use update-alternatives --config java to manage.

Shell script (kind of automated)

Last but not least: oab-java can be used to build .deb packages from the tar.gz provided by Oracle.

share|improve this answer

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.