Re: java, javac versions not the same, apt-get doesn't help ...

2018-01-12 Thread Albretch Mueller
On 1/12/18, Bastien Durel  wrote:
> Le vendredi 12 janvier 2018 à 04:20 -0500, Albretch Mueller a écrit :
>> java gives you error messages when you compile and run code with
>> different versions of the JVM
>>
>> while trying to update my box using apt-get I am getting:
>> "openjdk-8-jdk is already the newest version."
>>
>> How do you make sure you install the same version of both java and
>> javac using apt-get?
>>
>> lbrtchx
>> ~
>> $ uname -a
>> Linux IBMThnkPdT60 3.16.0-4-686-pae #1 SMP Debian 3.16.36-1+deb8u1
>> (2016-09-03) i686 GNU/Linux
>>
>> $ java -version
>> openjdk version "1.8.0_131"
>> OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-1~bpo8+1-b11)
>> OpenJDK Server VM (build 25.131-b11, mixed mode)
>>
>> $ javac -version
>> javac 1.7.0_111
>>
>>
>> # _LOG_FL="openjdk-8-jdk_install_$(date +%Y%m%d%H%M%S).log"
>>
>> # uname -a >> "${_LOG_FL}" 2>&1
>>
>> # time(apt-get -V install openjdk-8-jdk) >> "${_LOG_FL}" 2>&1
>>
>> # cat openjdk-8-jdk_install_20180112040601.log
>> Linux IBMThnkPdT60 3.16.0-4-686-pae
>> #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) i686 GNU/Linux
>>
>> Reading package lists...
>> Building dependency tree...
>> Reading state information...
>> openjdk-8-jdk is already the newest version.
>> 0 upgraded, 0 newly installed, 0 to remove and 365 not upgraded.
>>
>> real0m3.571s
>> user0m0.672s
>> sys 0m0.092s
>>
>> # java -version
>> openjdk version "1.8.0_131"
>> OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-1~bpo8+1-b11)
>> OpenJDK Server VM (build 25.131-b11, mixed mode)
>>
>> # javac -version
>> javac 1.7.0_111
>>
> You d'like to look at your alternatives
>
> $ ls -l /etc/alternatives/java*
> lrwxrwxrwx 1 root root 46 juil.  2  2017 /etc/alternatives/java ->
> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
> lrwxrwxrwx 1 root root 56 juil.  2  2017 /etc/alternatives/java.1.gz ->
> /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/java.1.gz
> lrwxrwxrwx 1 root root 39 déc.  14  2010 /etc/alternatives/java_vm ->
> /usr/lib/jvm/java-6-sun/jre/bin/java_vm
> lrwxrwxrwx 1 root root 38 déc.  14  2010 /etc/alternatives/javaws ->
> /usr/lib/jvm/java-6-sun/jre/bin/javaws
> lrwxrwxrwx 1 root root 48 déc.  14  2010 /etc/alternatives/javaws.1.gz
> -> /usr/lib/jvm/java-6-sun/jre/man/man1/javaws.1.gz
>
> On this box, java and javaws use different java versions
> You can set them using update-alternatives(1) -- or update-java-
> alternatives(8) for java

 Well, yes, but, based on my poor understanding of such matters, how
can you change the alternatives if apt-get doesn't install more
updated versions? I think you should be able to specify to the
differencet utilities in the jdk. This is what I got in my env:

$ ls -l /etc/alternatives/java*
lrwxrwxrwx 1 root root 45 Dec 17 18:16 /etc/alternatives/java ->
/usr/lib/jvm/java-8-openjdk-i386/jre/bin/java
lrwxrwxrwx 1 root root 55 Dec 17 18:16 /etc/alternatives/java.1.gz ->
/usr/lib/jvm/java-8-openjdk-i386/jre/man/man1/java.1.gz
lrwxrwxrwx 1 root root 42 Nov 11 22:14 /etc/alternatives/javac ->
/usr/lib/jvm/java-7-openjdk-i386/bin/javac
lrwxrwxrwx 1 root root 52 Nov 11 22:14 /etc/alternatives/javac.1.gz ->
/usr/lib/jvm/java-7-openjdk-i386/man/man1/javac.1.gz
lrwxrwxrwx 1 root root 44 Nov 11 22:14 /etc/alternatives/javadoc ->
/usr/lib/jvm/java-7-openjdk-i386/bin/javadoc
lrwxrwxrwx 1 root root 54 Nov 11 22:14 /etc/alternatives/javadoc.1.gz
-> /usr/lib/jvm/java-7-openjdk-i386/man/man1/javadoc.1.gz
lrwxrwxrwx 1 root root 42 Nov 11 22:14 /etc/alternatives/javah ->
/usr/lib/jvm/java-7-openjdk-i386/bin/javah
lrwxrwxrwx 1 root root 52 Nov 11 22:14 /etc/alternatives/javah.1.gz ->
/usr/lib/jvm/java-7-openjdk-i386/man/man1/javah.1.gz
lrwxrwxrwx 1 root root 42 Nov 11 22:14 /etc/alternatives/javap ->
/usr/lib/jvm/java-7-openjdk-i386/bin/javap
lrwxrwxrwx 1 root root 52 Nov 11 22:14 /etc/alternatives/javap.1.gz ->
/usr/lib/jvm/java-7-openjdk-i386/man/man1/javap.1.gz
$

# update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  SelectionPath   Priority   Status

  0/usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1071
  auto mode
  1/usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1071
  manual mode
* 2/usr/lib/jvm/java-8-openjdk-i386/jre/bin/java   1069
  manual mode

Press enter to keep the current choice[*], or type selection number:

# update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac).

  SelectionPathPriority   Status

* 0/usr/lib/jvm/java-7-openjdk-i386/bin/javac   1071  auto mode
  1/usr/lib/jvm/java-7-openjdk-i386/bin/javac   1071
manual mode
  2/usr/lib/jvm/java-8-openjdk-i386/bin/javac   1069
manual mode

Press enter to keep the 

Re: java, javac versions not the same, apt-get doesn't help ...

2018-01-12 Thread Bastien Durel
Le vendredi 12 janvier 2018 à 04:20 -0500, Albretch Mueller a écrit :
> java gives you error messages when you compile and run code with
> different versions of the JVM
> 
> while trying to update my box using apt-get I am getting:
> "openjdk-8-jdk is already the newest version."
> 
> How do you make sure you install the same version of both java and
> javac using apt-get?
> 
> lbrtchx
> ~
> $ uname -a
> Linux IBMThnkPdT60 3.16.0-4-686-pae #1 SMP Debian 3.16.36-1+deb8u1
> (2016-09-03) i686 GNU/Linux
> 
> $ java -version
> openjdk version "1.8.0_131"
> OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-1~bpo8+1-b11)
> OpenJDK Server VM (build 25.131-b11, mixed mode)
> 
> $ javac -version
> javac 1.7.0_111
> 
> 
> # _LOG_FL="openjdk-8-jdk_install_$(date +%Y%m%d%H%M%S).log"
> 
> # uname -a >> "${_LOG_FL}" 2>&1
> 
> # time(apt-get -V install openjdk-8-jdk) >> "${_LOG_FL}" 2>&1
> 
> # cat openjdk-8-jdk_install_20180112040601.log
> Linux IBMThnkPdT60 3.16.0-4-686-pae
> #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) i686 GNU/Linux
> 
> Reading package lists...
> Building dependency tree...
> Reading state information...
> openjdk-8-jdk is already the newest version.
> 0 upgraded, 0 newly installed, 0 to remove and 365 not upgraded.
> 
> real0m3.571s
> user0m0.672s
> sys 0m0.092s
> 
> # java -version
> openjdk version "1.8.0_131"
> OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-1~bpo8+1-b11)
> OpenJDK Server VM (build 25.131-b11, mixed mode)
> 
> # javac -version
> javac 1.7.0_111
> 
You d'like to look at your alternatives

$ ls -l /etc/alternatives/java*
lrwxrwxrwx 1 root root 46 juil.  2  2017 /etc/alternatives/java ->
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
lrwxrwxrwx 1 root root 56 juil.  2  2017 /etc/alternatives/java.1.gz ->
/usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/java.1.gz
lrwxrwxrwx 1 root root 39 déc.  14  2010 /etc/alternatives/java_vm ->
/usr/lib/jvm/java-6-sun/jre/bin/java_vm
lrwxrwxrwx 1 root root 38 déc.  14  2010 /etc/alternatives/javaws ->
/usr/lib/jvm/java-6-sun/jre/bin/javaws
lrwxrwxrwx 1 root root 48 déc.  14  2010 /etc/alternatives/javaws.1.gz
-> /usr/lib/jvm/java-6-sun/jre/man/man1/javaws.1.gz

On this box, java and javaws use different java versions
You can set them using update-alternatives(1) -- or update-java-
alternatives(8) for java

-- 
Bastien