Page 1 of 1

how to update

Posted: Mon May 19, 2014 5:15 pm
by Ja$on
how do i update java?

Re: how to update

Posted: Mon May 19, 2014 5:19 pm
by fruitoftheloom
Ja$on wrote:how do i update java?
What Linux Distribution ?

What version of Java do you have and why the need to update ?

Re: how to update

Posted: Mon May 19, 2014 9:11 pm
by Ja$on
how can i update the java on raspbian

Re: how to update

Posted: Mon May 19, 2014 9:48 pm
by DougieLawson
From what version to what new version?

sudo apt-get install oracle-java8-jdk is probably a good starting point.

Re: how to update

Posted: Thu May 22, 2014 10:37 am
by Fidelius
DougieLawson wrote:sudo apt-get install oracle-java8-jdk is probably a good starting point.
This works, and it installs Java 8 in "/usr/lib/jvm/" but how do we make Raspbian to use this Java 8 as standard? I.e. when we type "java ...".

Before the "apt-get install oracle-java8-jdk" command, I removed with apt-get all older OpenJDK and Oracle Java's. However, apt-get always insists to have (i.e. auto-selects) some older GNU Java or so because of dependencies. That is why when I type "java -version" now, I get:

Code: Select all

java version "1.5.0"
gij (GNU libgcj) version 4.7.2
... despite having used "apt-get install oracle-java8-jdk" as the last operation, Raspbian always uses this old GNU Java.

The folder "/usr/lib/jvm/" shows these three folders or links now :

Code: Select all

drwxr-xr-x ... java-1.5.0-gcj-4.7
lrwxrwxrwx ... java-gcj-4.7 -> java-1.5.0-gcj-4.7
drwxr-xr-x ... jdk-8-oracle-arm-vfp-hflt
(Formerly I used the Java 8's tar.gz archive from Oracle, untared it to /opt/ and changed the path in /etc/profile . However I'd like to see how a standard Raspbian behaves since Java 8 is in the apt-get repository... :-)

Thanks for any hints.

Re: how to update

Posted: Thu May 22, 2014 11:21 am
by DougieLawson
What do you get from
sudo dpkg -l | grep java

What's in /etc/alternatives/*java*

Re: how to update

Posted: Thu May 22, 2014 1:12 pm
by Fidelius
DougieLawson wrote:What do you get from
sudo dpkg -l | grep java

Code: Select all

rc ca-certificates-java            20121112+nmu2          all   Common CA certific..
rc libatk-wrapper-java-jni:armhf   0.30.4-3               armhf ATK implementation..
ii libhsqldb-java                  1.8.0.10+dfsg-0+deb7u1 all   Java SQL database ..
ii libjavascriptcoregtk-1.0-0      1.8.1-3.4+rpi1         armhf Javascript engine ..
ii libjavascriptcoregtk-3.0-0      1.8.1-3.4+rpi1         armhf Javascript engine ..
ii libjaxp1.3-java                 1.3.05-2               all   Java XML parser an..
ii libreoffice-java-common         1:3.6.1-1+rpi1         all   office productivit..
ii libservlet2.5-java              6.0.35-6+deb7u1        all   Servlet 2.5 and JS..
ii libxalan2-java                  2.7.1-7+deb7u1         all   XSL Transformation..
ii libxerces2-java                 2.11.0-6               all   Validating XML par..
ii libxml-commons-external-java    1.4.01-2               all   XML Commons extern..
ii libxml-commons-resolver1.1-java 1.2-7                  all   XML entity and URI..
ii oracle-java8-jdk                8                      armhf Java™ Platform, St..
What's in /etc/alternatives/*java*

Code: Select all

/etc/alternatives/java -> /usr/bin/gij-4.7
/etc/alternatives/javac -> /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/bin/javac
/etc/alternatives/javac.1.gz -> /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/man/man1/javac.1.gz
/etc/alternatives/javadoc -> /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/bin/javadoc
/etc/alternatives/javadoc.1.gz -> /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/man/man1/javadoc.1.gz
/etc/alternatives/javah -> /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/bin/javah
/etc/alternatives/javah.1.gz -> /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/man/man1/javah.1.gz
/etc/alternatives/javap -> /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/bin/javap
/etc/alternatives/javap.1.gz -> /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/man/man1/javap.1.gz

Re: how to update

Posted: Thu May 22, 2014 1:23 pm
by Fidelius
Thank to your hints I could figure out that the /etc/alternatives/java link is wrong. So I deleted and corrected it:

Code: Select all

sudo ln -s /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/bin/java /etc/alternatives/java
And now it seems to work! Thank you, Dougie-Lawson.

However, the question remains why the initial sudo apt-get install oracle-java8-jdk didn't create or correct this link, when it created all the remaining links (like to javac, and so on) ?
I would prefer the standard way (apt-get) without manually peeks and pokes. :-)

Re: how to update

Posted: Thu May 22, 2014 10:25 pm
by DougieLawson
There's a script update-alternatives that should get run by dpkg when you install Java8. Clearly something went wrong because you had /usr/bin/gij-4.7 (part of gcj-4.7-jdk) installed at some time.