1

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 :

Unpacking...
Checksumming...
Extracting...
./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

1 Answers1

0

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.

Manual

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

Example: java7.sh

#Set JDK for all users
JAVA_HOME=/opt/jdk1.7.0_25
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME CLASSPATH

when you need to use java, just . java7.sh or source java7.sh.

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.

Terry Wang
  • 10,185