Tell me more ×
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 Oracle's JDK 6?

I'm trying to manually install the Sun JDK package (I have my reasons, don't bother asking why). I've successfully extracted the .bin file into /usr/lib/jvm/jdk1.6.0_23, but the problem is the PATH variable.

I added this line to the /etc/environment file: JAVA_HOME="/usr/lib/jvm/jdk1.6.0_23" and added JAVA_HOME/bin to the PATH variable, BUT the OS still doesn't recognise the command java, says it's not installed and offers me gcj and openjdk.

There was another way by using java-package and converting the .bin to .deb installer, but unfortunately that package is not available on/for maverick, so I can't do it that way.

How can I make the PATH variable work and is there anything else required apart from the environment variables to make it all work?
When I try to use the update-java-alternatives -l command, it says the following:
awk: cannot open /usr/lib/jvm/*.jinfo (No such file or directory)
jdk1.6.0_23 /usr/lib/jvm/jdk1.6.0_23

What should be the name of the file and the contents of it?

share|improve this question
possible duplication - askubuntu.com/questions/21131/… – Ringtail Mar 12 '12 at 18:06

marked as duplicate by Bruno Pereira Mar 12 '12 at 20:28

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.

3 Answers

up vote 2 down vote accepted

I added this line to the /etc/environment file: JAVA_HOME="/usr/lib/jvm/jdk1.6.0_23" and added JAVA_HOME/bin to the PATH variable, BUT the OS still doesn't recognise the command java, says it's not installed and offers me gcj and openjdk.

Did you check it?

echo $JAVA_HOME 
echo $PATH

If you don't need it: Deinstall openjdk and gcj in synaptic or with apt-get.

apt-get remove gcj 
apt-get remove openjdk

I would ban java from alternatives then, and do mostly as BillThor suggested, why I gave him an upvote.

which javac
which java

should point to where you installed java, and where it is found in the PATH.

share|improve this answer
I don't have gcj or openjdk installed... Just tried the which commands and it prints nothing. Found out that I forgot the $ symbol before the JAVA_HOME variable in PATH, I'll restart now and see how it goes. – jurchiks Feb 13 '11 at 11:19
Restarted the PC, but the which command still shows nothing. Both JAVA_HOME and PATH variables are correct: echo $JAVA_HOME /usr/lib/jvm/jdk1.6.0_23 echo $PATH $JAVA_HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr‌​/games Where could be the problem? Edit: GOD DAMN IT, why are there no line breaks in comments?? – jurchiks Feb 13 '11 at 11:53
a) restarting the PC shouldn't be required. Reopen the shell should suffice, or mostly relogin as user. b) Look inside the help for formatting in comments. I see echo $PATH $JAVA_HOME/bin:/usr/local/sbin... but in the result $JAVA_HOME must be evaluated - there is something wrong, or your reporting is mistakable. c) Linebreaks: They aren't there, so that we constantly hit ENTER too early, and then the clock ticks, because editing is just for few minutes allowed - I constantly step into that trap. I hate it! :) – user unknown Feb 13 '11 at 12:38
Well, the JAVA_HOME variable is in the same file (/etc/environment), just in the first line. Maybe it should be somewhere else? It recognises it when I type echo $JAVA_HOME though... – jurchiks Feb 13 '11 at 14:16
My question was: Does echo $PATH print $JAVA_HOME... or does it print the value for JAVA_HOME, i.e.: /usr/lib/jvm/jdk1.6.0_23 ? – user unknown Feb 14 '11 at 0:37
show 7 more comments

The .jdk1.6.0_23.jinfo file should be a list of the supplied programs and their paths. There is a descriptive header followed by a blank line. Then a list of the programs in a three field format: entry type (jre/jkd/plugin); program name; and path. You should have some jinfo files you can use to see what the contents should look like. This is likely used by the alternatives mechanism to determine which links to create. The head of my Sun package is.

name=java-6-sun-1.6.0.22
alias=java-6-sun
priority=63
section=non-free

jre ControlPanel /usr/lib/jvm/java-6-sun/jre/bin/ControlPanel
jre java /usr/lib/jvm/java-6-sun/jre/bin/java
jre java_vm /usr/lib/jvm/java-6-sun/jre/bin/java_vm

If you want to override the default Java commands without using the alternatives mechanism put your Java path ahead of /usr/bin in your path.

When doing a manual install, I install Java in /opt. for your install I would have installed in /opt/jdk1.6.0_23. Then I put the path $JAVA_HOME/bin at the start of my PATH variable.

EDIT: This is the whole Sun file. Note .java-6-sun.jinfo is a symbolic link to .java-6-sun-1.6.0.22.jinfo.

name=java-6-sun-1.6.0.22
alias=java-6-sun
priority=63
section=non-free

jre ControlPanel /usr/lib/jvm/java-6-sun/jre/bin/ControlPanel
jre java /usr/lib/jvm/java-6-sun/jre/bin/java
jre java_vm /usr/lib/jvm/java-6-sun/jre/bin/java_vm
jre javaws /usr/lib/jvm/java-6-sun/jre/bin/javaws
jre jcontrol /usr/lib/jvm/java-6-sun/jre/bin/jcontrol
jre keytool /usr/lib/jvm/java-6-sun/jre/bin/keytool
jre pack200 /usr/lib/jvm/java-6-sun/jre/bin/pack200
jre policytool /usr/lib/jvm/java-6-sun/jre/bin/policytool
jre rmid /usr/lib/jvm/java-6-sun/jre/bin/rmid
jre rmiregistry /usr/lib/jvm/java-6-sun/jre/bin/rmiregistry
jre unpack200 /usr/lib/jvm/java-6-sun/jre/bin/unpack200
jre orbd /usr/lib/jvm/java-6-sun/jre/bin/orbd
jre servertool /usr/lib/jvm/java-6-sun/jre/bin/servertool
jre tnameserv /usr/lib/jvm/java-6-sun/jre/bin/tnameserv
jre jexec /usr/lib/jvm/java-6-sun/jre/lib/jexec
jdk HtmlConverter /usr/lib/jvm/java-6-sun/bin/HtmlConverter
jdk appletviewer /usr/lib/jvm/java-6-sun/bin/appletviewer
jdk apt /usr/lib/jvm/java-6-sun/bin/apt
jdk extcheck /usr/lib/jvm/java-6-sun/bin/extcheck
jdk idlj /usr/lib/jvm/java-6-sun/bin/idlj
jdk jar /usr/lib/jvm/java-6-sun/bin/jar
jdk jarsigner /usr/lib/jvm/java-6-sun/bin/jarsigner
jdk javac /usr/lib/jvm/java-6-sun/bin/javac
jdk javadoc /usr/lib/jvm/java-6-sun/bin/javadoc
jdk javah /usr/lib/jvm/java-6-sun/bin/javah
jdk javap /usr/lib/jvm/java-6-sun/bin/javap
jdk jconsole /usr/lib/jvm/java-6-sun/bin/jconsole
jdk jdb /usr/lib/jvm/java-6-sun/bin/jdb
jdk jhat /usr/lib/jvm/java-6-sun/bin/jhat
jdk jinfo /usr/lib/jvm/java-6-sun/bin/jinfo
jdk jmap /usr/lib/jvm/java-6-sun/bin/jmap
jdk jps /usr/lib/jvm/java-6-sun/bin/jps
jdk jrunscript /usr/lib/jvm/java-6-sun/bin/jrunscript
jdk jsadebugd /usr/lib/jvm/java-6-sun/bin/jsadebugd
jdk jstack /usr/lib/jvm/java-6-sun/bin/jstack
jdk jstat /usr/lib/jvm/java-6-sun/bin/jstat
jdk jstatd /usr/lib/jvm/java-6-sun/bin/jstatd
jdk native2ascii /usr/lib/jvm/java-6-sun/bin/native2ascii
jdk rmic /usr/lib/jvm/java-6-sun/bin/rmic
jdk schemagen /usr/lib/jvm/java-6-sun/bin/schemagen
jdk serialver /usr/lib/jvm/java-6-sun/bin/serialver
jdk wsgen /usr/lib/jvm/java-6-sun/bin/wsgen
jdk wsimport /usr/lib/jvm/java-6-sun/bin/wsimport
jdk xjc /usr/lib/jvm/java-6-sun/bin/xjc
plugin xulrunner-1.9-javaplugin.so /usr/lib/jvm/java-6-sun/jre/lib/amd64/libnpjp2.so
plugin mozilla-javaplugin.so /usr/lib/jvm/java-6-sun/jre/lib/amd64/libnpjp2.so
share|improve this answer
I don't have any java installed so I don't have anything related to it, nothing installed, no .jinfo files etc. I created the usr/lib/jvm folder myself because I read that that's where it's installed by default, and I'm going to keep it that way. That's why I would like to see the full content of the .jinfo file for the Sun's JDK. – jurchiks Feb 13 '11 at 11:18
I've added the full sun .jinfo file. – BillThor Feb 13 '11 at 15:58
Thanks for that. – jurchiks Feb 14 '11 at 10:35

First: remove openjdk and icedtea plugin.

sudo apt-get remove openjdk* icedtea*

Second: copy the .bin jdk file to /opt or /usr/java and extract it.

sudo cp jdk_1.16.0.bin /usr/java

Third: put a link of the java file to /usr/bin/

ln -s /usr/java/jdk_1.6.0/bin/java /usr/bin/java
ln -s /usr/java/jdk_1.6.0/bin/javac /usr/bin/javac

update the alternatives using update-alternatives

Create a symbolic link to the Java Plugin in the Firefox plugins directory.

Create a symbolic link to the Java Plugin libnpjp2.so file in the Firefox plugins directory:

   cd  

<Firefox>/plugins


 ln -s  

<JRE>/lib/i386/libnpjp2.so .

Hope this helps.

share|improve this answer
Didn't you miss a step after cp, and before linking? And: You suggest manual linking, but there are 45 files in java/bin, most of them executable. Would you like to make 25 symbolic links? I would prefer changing the PATH. – user unknown Feb 13 '11 at 7:48
as far as i know the steps are correct. you can refer to the tutorial on sun(oracle's) java installation page. the above steps worked for me though!. let me know how you get along. – Ubuntuser Feb 14 '11 at 17:33

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