我正在尝试在 Linux 上优化 Minecraft,它说要获取最新的 OpenJDK JRE。
我当前的设置是:
$ sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-11-openjdk-amd64/bin/java
Nothing to configure.
$ uname -m
x86_64
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 5500 (rev 09)
当我尝试安装 openjdk-18 JRE 时出现错误:
$ sudo apt install -y openjdk-18-jre
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package openjdk-18-jre
当我尝试搜索 apt-cache 时,我只发现:
apt-cache search openjdk
default-jdk - Standard Java or Java compatible Development Kit
default-jdk-doc - Standard Java or Java compatible Development Kit (documentation)
default-jdk-headless - Standard Java or Java compatible Development Kit (headless)
default-jre - Standard Java or Java compatible Runtime
default-jre-headless - Standard Java or Java compatible Runtime (headless)
openjdk-11-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-11-doc - OpenJDK Development Kit (JDK) documentation
openjdk-11-jdk - OpenJDK Development Kit (JDK)
openjdk-11-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-11-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-11-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-11-source - OpenJDK Development Kit (JDK) source files
crypto-policies - unify the crypto policies used by different applications and libraries
jtreg - Regression Test Harness for the OpenJDK platform
libhsdis0-fcml - HotSpot disassembler plugin using FCML
libjax-maven-plugin - Using the xjc goal with OpenJDK 11+
libreoffice - office productivity suite (metapackage)
openjdk-11-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-11-jre-dcevm - Alternative VM for OpenJDK 11 with enhanced class redefinition
openjdk-11-jre-zero - Alternative JVM for OpenJDK, using Zero
openjdk-8-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-8-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-8-doc - OpenJDK Development Kit (JDK) documentation
openjdk-8-jdk - OpenJDK Development Kit (JDK)
openjdk-8-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-8-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-8-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-8-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark
openjdk-8-source - OpenJDK Development Kit (JDK) source files
uwsgi-app-integration-plugins - plugins for integration of uWSGI and application
uwsgi-plugin-jvm-openjdk-11 - Java plugin for uWSGI (OpenJDK 11)
uwsgi-plugin-jwsgi-openjdk-11 - JWSGI plugin for uWSGI (OpenJDK 11)
uwsgi-plugin-ring-openjdk-11 - Closure/Ring plugin for uWSGI (OpenJDK 11)
uwsgi-plugin-servlet-openjdk-11 - JWSGI plugin for uWSGI (OpenJDK 11)
java-package - Utility for creating Java Debian packages
openjdk-13-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-13-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-13-doc - OpenJDK Development Kit (JDK) documentation
openjdk-13-jdk - OpenJDK Development Kit (JDK)
openjdk-13-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-13-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-13-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-13-jre-zero - Alternative JVM for OpenJDK, using Zero
openjdk-13-source - OpenJDK Development Kit (JDK) source files
openjdk-16-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-16-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-16-doc - OpenJDK Development Kit (JDK) documentation
openjdk-16-jdk - OpenJDK Development Kit (JDK)
openjdk-16-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-16-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-16-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-16-jre-zero - Alternative JVM for OpenJDK, using Zero
openjdk-16-source - OpenJDK Development Kit (JDK) source files
openjdk-17-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-17-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-17-doc - OpenJDK Development Kit (JDK) documentation
openjdk-17-jdk - OpenJDK Development Kit (JDK)
openjdk-17-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-17-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-17-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-17-jre-zero - Alternative JVM for OpenJDK, using Zero
openjdk-17-source - OpenJDK Development Kit (JDK) source files
postgresql-10-pljava - Java procedural language for PostgreSQL 10
postgresql-11-pljava - Java procedural language for PostgreSQL 11
postgresql-12-pljava - Java procedural language for PostgreSQL 12
postgresql-13-pljava - Java procedural language for PostgreSQL 13
postgresql-14-pljava - Java procedural language for PostgreSQL 14
postgresql-9.5-pljava - Java procedural language for PostgreSQL 9.5
postgresql-9.6-pljava - Java procedural language for PostgreSQL 9.6
我可能只会安装 openjdk-17-jre,但现在这真的让我很烦,因为我可以点击这里。
如果有人关心 Minecraft Launcher 说我使用的是 Minecraft 1.19
我正在关注的指南:
答案1
您可以将其下载并安装在 /opt/ 中,这样它就不会干扰当前安装的版本。命令:
下载:
wget https://download.java.net/java/GA/jdk18/43f95e8614114aeaa8e8a5fcf20a682d/36/GPL/openjdk-18_linux-x64_bin.tar.gz
提取下载内容(将 {version} 替换为下载的版本):
tar -xvf openjdk-18._linux-{version}
将其移动到/opt/:
sudo mv jdk-18* /opt/
(如果需要,可以将 jdk-18 替换为其他内容)并设置环境变量:
export JAVA_HOME=/opt/jdk-18
export PATH=$PATH:$JAVA_HOME/bin
检查是否正确进行:
cd /opt/jdk-18/
java --version
echo $JAVA_HOME
通过重新进行导出以排除/opt/jdk-18
您恢复旧的情况