ToolsLinux

archLinux(Manjaro)中的Java版本切换

2019-06-19  本文已影响3人  maxzhao_

JDK 安装

安装多个JDK时

我这里先安装的 jdk8-openjdk,后安装 jdk12

安装 jdk12时提示:

Default Java environment is already set to 'java-8-openjdk'
See 'archlinux-java help' to change it.
When you use a non-reparenting window manager,
set _JAVA_AWT_WM_NONREPARENTING=1 in /etc/profile.d/jre.sh
jre 的可选依赖
    alsa-lib: for basic sound support [已安装]
(3/3) 正在安装 jdk                                           [################################] 100%
Default Java environment is already set to 'java-8-openjdk'
See 'archlinux-java help' to change it

切换 JDK 版本

使用archlinux-java命令切换JDK 版本

archlinux-java help

archlinux-java <COMMAND>

COMMAND:
    status      List installed Java environments and enabled one
    get     Return the short name of the Java environment set as default
    set <JAVA_ENV>  Force <JAVA_ENV> as default
    unset       Unset current default Java environment
    fix     Fix an invalid/broken default Java environment configuration

set <JAVA_ENV> 就是设置默认环境的方法

set 之前
java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)
执行sudo archlinux-java set java-12-jdk
set 之后
java -version
java version "12.0.1" 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)

JDK版本切换就成功了,非常简单吧。

本文地址:archLinux(Manjaro)中的Java版本切换

推荐:

arch-gnome 编程环境和其它环境安装
u盘安装manjaro——抛弃Centos的旅程开始

上一篇下一篇

猜你喜欢

热点阅读