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. > > real 0m3.571s > user 0m0.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