Debian 10. Ставил яву по этой инструкции, в частности, скачал JDK c сайта, а потом
cd ~/Downloads
sudo tar -xf jdk-15.0.1_linux-x64_bin.tar.gz -C /usr/lib/jvm
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-15.0.1/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-15.0.1/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk-15.0.1/bin/javaws 15
Теперь у меня
c@c-desktop:~/Projects$ java -version
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-post-Debian-1deb10u2)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-post-Debian-1deb10u2, mixed mode, sharing)
c@c-desktop:~/Projects$ javac -version
javac 15.0.1
c@c-desktop:~/Projects$
Соответственно,
c@c-desktop:~/Projects$ java -cp . MyFirstApp
Выдаёт
Error: LinkageError occurred while loading main class MyFirstApp java.lang.UnsupportedClassVersionError: MyFirstApp has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 55.0
Кстати,
c@c-desktop:~/Projects$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk-15.0.1/bin/javaws 15
update-alternatives: ошибка: альтернативный путь /usr/lib/jvm/jdk-15.0.1/bin/javaws не существует
c@c-desktop:~/Projects$
Так вот, могу я даунгрейднуть версию JDK, до «11.0.9.1»? Кстати, как соотносится «11.0.9.1» и 55.0 JRE?
А, ну, да,
c@c-desktop:~/Projects$ /usr/lib/jvm/jdk-15.0.1/bin/java -version
java version "15.0.1" 2020-10-20
Java(TM) SE Runtime Environment (build 15.0.1+9-18)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)