AidLearning安装Oracle JDK让Java Swing程序在华为MatePadPro平板上跑起来

cemike@126.com

入手华为MatePadPro平板以后就有把windows台式机上的swing程序移植到平板上运行的想法(全部改写为android程序也不是不可以,但是势必工作量巨大,想着都累)。自封的程序猿向来宁可用六小时编程解决本来手动运算一分钟可以搞定的问题,这次也不例外。关键是只要一个Java版的HelloWorld跑成功后面所有Swing程序都可以毫不费劲地移植的愿景太具有诱惑力了:以后就可以摆脱台式机,甚至都不用背笔记本,直接带上轻薄的平板,多优雅!

开始的思路是找安卓上的windows模拟环境。就像linux上有了cygwin,windows上可以运行linux一样;Windows 也可以运行Android 模拟器。那么一定可以反其道而行之,网上还真有exagear、BOCHS等这样可以在安卓上跑windows的模拟环境,但是据说性能不佳,最后望而却步。

接触到才不到10M的AidLearning就把整个Debian系统搬到了安卓上,虽然有网友表示在小米等手机上体验很差,但在华为MatePadPro平板上还不错,感觉像发现了星辰大海。AidLearning本意是主打Python做人工智能(AI),我眼里它却是一个以前遥不可及而现在触手可及的Linux(Debian)上的Java梦!

接下来就着手在这个AidLearning里的Debian系统里折腾JDK。AidLearning的Service里可以很方便地安装OpenJDK11,成功实战了HelloWorld.java之后喜不自胜,但一进入Swing(至少AWT或Applet)就是地狱。首先默认桌面上的终端里是不会出现图形GUI的。后来发现XFCE里面的终端里运行会出现图形GUI的窗口,但问题是只有窗口,窗口里的组件一片空白。在百度上反复搜索确认不是自己的代码有问题及在台式机windows里用同样的代码验证之后,逐渐将问题锁定在OpenJDK11上,网上看了N篇文章,最后确认,Java应用程序Swing GUI空白问题在我的Debian上不是个例,在Ubuntu 8.04(https://www.linuxidc.com/linux/2008-07/14385.htm),ArchLinux build 7.u13_2.3.7-2-x86_64(https://bbs.archlinux.org/viewtopic.php?id=159016),甚至苹果机(https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6311320)上都存在,每个帖子都各出奇招(在~/.bashrc中加上一行:export AWT_TOOLKIT=MToolkit;或_JAVA_AWT_WM_NONREPARENTING=1)解决了他们的问题,然而却没有解决我的问题!最后一篇帖子里明确说了这个bug从JDK 11.0.6开始(我的Debian系统openjdk版本正是11.0.6),而且这个问题要到JDK14官方才给解决。等不了!

root@localhost:~# java -version
 openjdk version “11.0.6” 2020-01-14OpenJDK Runtime Environment (build 11.0.6+10-post-Debian-1deb10u1)OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Debian-1deb10u1, mixed mode)

这个版本有bug只能倒退到之前的版本,就是说要卸载和重新安装。做出这个决定积攒了很久的勇气,因为在我这个Linux小白的潜意识里就知道这是要对系统动大手术。牵一发而动全身,别新的不成功还把旧的OpenJDK给搞坏了。

但最后还是走上了这条不归路。既然要动手术,不如干脆卸载OpenJDK11换Oracle JDK 8,毕竟官方的Java比开源的全面。

下面把跳过的坑梳理一下注意事项:

1.因为是华为平板,必须下载aarch64架构的安装包。之前安装了linux32位的及linux64位的jdk,死活提示“java不是文件或目录”。开始时以为环境变量或者软链接没设置对。直到看到一篇提到将32位jdk换成64位的jdk成功的文章才豁然开朗,意识到自己的华为平板是arm64架构的,必须下载aarch64架构的jdk。windows上习惯了32位的及64位的区别,安装不对程序跑不起来也会提示32位或64位,没意识到安卓还有arm架构。而且linux系统程序跑不起来也不会提示架构错误,直接提示“java不是文件或目录”真是误导人啊。自己到安装目录反复查看确认的确存在bin/java文件,困惑不解。一度走了老长的弯路,以为是环境变量或者软链接没设置对。
jdk-8u271-linux-aarch64.tar.gz下载:https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html

2.Linux上卸载和安装jdk的方法有N种,不像windows只有exe安装包和绿色免安装两种!apt-get, rpm, yum甚至纯手动安装。用apt-get卸载jdk,又有apt-get remove 与 apt-get purge两种选择,每一次做选择都很痛苦。rpm, yum在这个Debian系统里都没有。安装jdk选择了下载.tar.gz文件,用tar命令解压的方式。将台式机上下载的.tar.gz文件弄进平板的模拟Debian系统也是个问题,幸好AidLearning支持云桌面(手机桌面和电脑桌面相同),可以在电脑端在浏览器输入网址直接访问,和平板上显示的桌面完全相同(网页里点击XFCE支持图形化桌面,很神奇),而且键盘鼠标无缝衔接。里面的Finder又有上传(向上箭头按钮)功能。

3.装完之后还得配置环境变量。/etc/profile、/root/.bashrc、/root/.bash_profile和/root/.profile四者之间很混淆啊。后来知道/etc/profile的设置会覆盖后两者,而在Debian里只有/root/.profile没有/root/.bash_profile。弄清每一个真相都耗了不少时间。

4.最后还有建立更新软链接。以为配置环境变量就能开心玩耍?图样图森破!依然死活提示“bash: java未知命令”或“java不是文件或目录”。明明java就在那里,怎么会没有呢?后来明白了:如果文件本身存在如/usr/lib/jvm/jdk1.8.0_271/bin/java且没架构(linux32位/linux64位/arm64位)等问题,那么在/usr/lib/jvm/jdk1.8.0_271/bin目录里是能够通过./java执行的(哪怕报错)。如果一直报错“java不是文件或目录”,那是这个文件本身有问题,就像不存在一样。windows报错弹窗消息太多让人诟病,Linux出错了也不吭一声也很心累啊。不过过程中倒是把update-alternatives和ln命令学会了:update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-1.8.0_271/bin/java 300
update-alternatives --install <链接> <名称> <路径> <优先级>
这些参数像让人走进迷宫。
<链接>通常是/usr/bin/[你的程序名称],以java为例就是/usr/bin/java。[你的程序名称]即这里的java就是你最好在终端里敲入的命令java。
<名称>是你自己取的名字,为了怕混乱通常是和<链接>中的[你的程序名称]相同,也是java。
<路径>是你程序的真实物理存储路径,如/usr/lib/jvm/jdk1.8.0_271/bin/java前面都是路径(目录),最后一段java是程序文件,是真实包含代码的文件。不像windows程序或文件都有.exe, .txt等后缀,Linux文件没有后缀,很容易跟目录混淆,非常考验人呐。<优先级>虽然是任意定的整数如200,300,7000等,但是不能少,update-alternatives就是看谁的优先级高(数值越大)就优先调用谁。
这三个参数里每一个都有java,每一个java的意义都不一样,让文科生情何以堪?如果不小心敲错了还得用update-alternatives --remove或–remove-all删除重头再来,为什么没有–edit修改?
管理版本切换的update-alternatives不就是建立软链接命令ln的升级版本嘛。update-alternatives内部一定调用了建立软链接命令ln。为什么看了那么多网络文章就没有一人点破呢?而且同样介绍安装jdk的文章有的用ln命令,有的用update-alternatives,让人莫衷一是。

5.过程中还有一些帮助诊断的命令

(1)whereis java 查找哪些文件/目录里出现了

javaroot@localhost:~# whereis java
 java: /usr/bin/java /usr/share/java /usr/lib/jvm/jdk1.8.0_271/bin/java /usr/lib/jvm/jdk1.8.0_271/jre/bin/java

(2)update-alternatives --display java 查找哪些软连接命令里出现了java

(3)ls -la /etc/alternatives/etc/alternatives# ls -l java
这时候java类似过滤参数,不是子目录

root@localhost:/home# ls -l /etc/alternatives/javalrwxrwxrwx. 1 root root 38 11月 20 18:48 /etc/alternatives/java -> /usr/lib/jvm/jdk1.8.0_271/bin/java
 root@localhost:/home# cd /etc/alternatives
 root@localhost:/etc/alternatives# ls -l javalrwxrwxrwx. 1 root root 38 11月 20 18:48 java -> /usr/lib/jvm/jdk1.8.0_271/bin/java
 root@localhost:/etc/alternatives#

(4)ls -la /usr/bin/java

root@localhost:/etc/alternatives# cd /usr/bin
 root@localhost:/usr/bin# ls -l javalrwxrwxrwx. 1 root root 26 11月 20 18:48 java -> /etc/alternatives/java


这里我们看到java指向软链接/etc/alternatives/java/usr/bin/有点像windows中的开始菜单中的快捷方式。root@localhost:/etc/alternatives# cd /etc/alternatives
root@localhost:/etc/alternatives# ls -l javalrwxrwxrwx. 1 root root 38 11月 20 18:48 java -> /usr/lib/jvm/jdk1.8.0_271/bin/java
这里我们又发现/etc/alternatives/java指向真实的物理文件/usr/lib/jvm/jdk1.8.0_271/bin/javaroot@localhost:/usr/bin# cd root@localhost:# ls -l /usr/bin/javalrwxrwxrwx. 1 root root 26 11月 20 18:48 /usr/bin/java -> /etc/alternatives/java
root@localhost:~# ls -l /usr/bin/java效果与在/usr/bin目录执行ls -l java命令效果相同

(5) which java
which指令会在环境变量$PATH设置的目录里查找符合条件的文件,并且返回第一个搜索结果。root@localhost:~# which java/usr/bin/java

(6)查看环境变量android平板java编程 华为平板的java编程软件_androidJAVA_HOME,$PATH,便于排查错误

root@localhost:~# echo $CLASSPATH
 .:/usr/lib/jvm/jdk1.8.0_202/lib/dt.jar:/usr/lib/jvm/jdk1.8.0_202/lib/tools.jar:/usr/lib/jvm/jdk1.8.0_202/jre/lib
 root@localhost:~# echo $JAVA_HOME
 /usr/lib/jvm/jdk1.8.0_202
 root@localhost:~# echo $PATH
 /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/jdk1.8.0_271/bin:/usr/lib/jvm/jdk1.8.0_271/jre/bin:/usr/local/python3/bin:/usr/local/bin:/usr/lib/jvm/jdk1.8.0_202/bin:/usr/lib/jvm/jdk1.8.0_202/jre/bin
 root@localhost:~#

(7)apt-cache search package 搜索软件包
apt-get install package 安装包(在线)
apt-get remove package 删除包
apt-get purge package – 删除包,包括配置文件等

(8)dpkg -l显示所有已安装软件
dpkg -i package.deb #安装包dpkg -r package #删除包
apt-get install 和 dpkg -i的区别(http://www.found5.com/view/589.html):
apt-get install 在线安装软件包,只需以软件包名字为参数,无需预先下载,需要的话先通过vim /etc/apt/sources.list编辑软件源(类似maven等软件仓库);
dpkg -i 先下载.deb后缀的软件包放在本地,以此软件包为参数。
apt会解决和安装模块的依赖问题,并会咨询软件仓库;
dpkg 绕过 apt 包管理数据库对软件包进行操作,所以你用 dpkg 安装过的软件包用 apt 可以再安装一遍,系统不知道之前安装过了,将会覆盖之前 dpkg 的安装。

root@localhost:~# dpkg -l期望状态=未知(u)/安装(i)/删除®/清除§/保持(h)| 状态=未安装(n)/已安装(i)/仅存配置©/仅解压缩(U)/配置失败(F)/不完全安装(H)/触发器等待(W)/触发器未决(T)|/ 错误?=(无)/须重装® (状态,错误:大写=故障)||/ 名称 版本 体系结构 描述

++±-=--===============================
 ii adb 1:8.1.0+r23-5 arm64 Android Debug Bridgeii adduser 3.118 all add and remove users and groupsii adwaita-icon-theme 3.30.1-1 all default icon theme of GNOMEii android-libadb 1:8.1.0+r23-5 arm64 Library for Android Debug Bridgeii android-libbase 1:8.1.0+r23-5 arm64 Android base libraryii android-libboringssl 8.1.0+r23-2 arm64 Google’s internal fork of OpenSSL forii android-libcrypto-utils 1:8.1.0+r23-5 arm64 Android crypto-utils libraryii android-libcutils 1:8.1.0+r23-5 arm64 Android utils library for Cii android-liblog 1:8.1.0+r23-5 arm64 Android NDK logger interfacesii android-sdk-platform-tools-common 27.0.0+11+deb10u1 all Tools for interacting with an Androidii android-tools-adb 1:8.1.0+r23-5 all transitional packageii apt 1.8.2 arm64 commandline package managerii apt-utils 1.8.2 arm64 package management related utility prii aspell 0.60.7~20110707-6 arm64 GNU Aspell spell-checkerii aspell-en 2018.04.16-0-1 all English dictionary for GNU Aspellii at-spi2-core 2.30.0-7 arm64 Assistive Technology Service Providerii autoconf 2.69-11 all automatic configure script builderii automake 1:1.16.1-4 all Tool for generating GNU Standards-comii autotools-dev 20180224.1 all Update infrastructure for config.{gueii base-files 10.3+deb10u3 arm64 Debian base system miscellaneous fileii base-passwd 3.5.46 arm64 Debian base system master password anii bash 5.0-4 arm64 GNU Bourne Again SHellii java-common 0.71 all Base package for Java runtimesii javascript-common 11 all Base support for JavaScript library pii jwm 2.3.7-2 arm64 very small lightweight pure X11 windo最后奉上全部安装过程终端输出:
root@localhost:/usr/lib/jvm# cd /root/java_devroot@localhost:~/java_dev# lsjdk-8u271-linux-aarch64.tar.gzroot@localhost:~/java_dev# tar -xzvf jdk-8u271-linux-aarch64.tar.gz -C /usr/lib/jvmjdk1.8.0_271/COPYRIGHTjdk1.8.0_271/LICENSEjdk1.8.0_271/README.htmljdk1.8.0_271/THIRDPARTYLICENSEREADME.txtjdk1.8.0_271/bin/jdk1.8.0_271/bin/jmapjdk1.8.0_271/bin/jstatjdk1.8.0_271/bin/rmiregistryjdk1.8.0_271/bin/jpsjdk1.8.0_271/bin/keytooljdk1.8.0_271/bin/tnameservjdk1.8.0_271/bin/jcmdjdk1.8.0_271/bin/jdbjdk1.8.0_271/bin/javajdk1.8.0_271/bin/wsimportjdk1.8.0_271/bin/servertooljdk1.8.0_271/bin/javacjdk1.8.0_271/bin/jrunscriptjdk1.8.0_271/bin/jarsignerjdk1.8.0_271/bin/extcheckjdk1.8.0_271/bin/xjcjdk1.8.0_271/bin/pack200jdk1.8.0_271/bin/wsgenjdk1.8.0_271/bin/unpack200jdk1.8.0_271/bin/javapjdk1.8.0_271/bin/jstackjdk1.8.0_271/bin/jjsjdk1.8.0_271/bin/idljjdk1.8.0_271/bin/rmicjdk1.8.0_271/bin/native2asciijdk1.8.0_271/bin/javadocjdk1.8.0_271/bin/orbdjdk1.8.0_271/bin/java-rmi.cgijdk1.8.0_271/bin/jinfojdk1.8.0_271/bin/jstatdjdk1.8.0_271/bin/rmidjdk1.8.0_271/bin/jdepsjdk1.8.0_271/bin/jhatjdk1.8.0_271/bin/jsadebugdjdk1.8.0_271/bin/policytooljdk1.8.0_271/bin/appletviewerjdk1.8.0_271/bin/schemagenjdk1.8.0_271/bin/jarjdk1.8.0_271/bin/serialverjdk1.8.0_271/bin/jconsolejdk1.8.0_271/bin/javahjdk1.8.0_271/include/jdk1.8.0_271/include/jdwpTransport.hjdk1.8.0_271/include/linux/jdk1.8.0_271/include/linux/jawt_md.hjdk1.8.0_271/include/linux/jni_md.hjdk1.8.0_271/include/classfile_constants.hjdk1.8.0_271/include/jawt.hjdk1.8.0_271/include/jvmti.hjdk1.8.0_271/include/jvmticmlr.hjdk1.8.0_271/include/jni.hjdk1.8.0_271/jre/jdk1.8.0_271/jre/THIRDPARTYLICENSEREADME.txtjdk1.8.0_271/jre/bin/jdk1.8.0_271/jre/bin/orbdjdk1.8.0_271/jre/bin/rmidjdk1.8.0_271/jre/bin/policytooljdk1.8.0_271/jre/bin/pack200jdk1.8.0_271/jre/bin/servertooljdk1.8.0_271/jre/bin/unpack200jdk1.8.0_271/jre/bin/rmiregistryjdk1.8.0_271/jre/bin/javajdk1.8.0_271/jre/bin/keytooljdk1.8.0_271/jre/bin/jjsjdk1.8.0_271/jre/bin/tnameservjdk1.8.0_271/jre/COPYRIGHTjdk1.8.0_271/jre/lib/jdk1.8.0_271/jre/lib/fontconfig.SuSE.10.bfcjdk1.8.0_271/jre/lib/jce.jarjdk1.8.0_271/jre/lib/psfontj2d.propertiesjdk1.8.0_271/jre/lib/fontconfig.Turbo.properties.srcjdk1.8.0_271/jre/lib/currency.datajdk1.8.0_271/jre/lib/fontconfig.properties.srcjdk1.8.0_271/jre/lib/content-types.propertiesjdk1.8.0_271/jre/lib/fontconfig.RedHat.6.properties.srcjdk1.8.0_271/jre/lib/rt.jarjdk1.8.0_271/jre/lib/applet/jdk1.8.0_271/jre/lib/fontconfig.SuSE.11.bfcjdk1.8.0_271/jre/lib/psfont.properties.jajdk1.8.0_271/jre/lib/flavormap.propertiesjdk1.8.0_271/jre/lib/net.propertiesjdk1.8.0_271/jre/lib/oblique-fonts/jdk1.8.0_271/jre/lib/oblique-fonts/LucidaTypewriterOblique.ttfjdk1.8.0_271/jre/lib/oblique-fonts/LucidaTypewriterBoldOblique.ttfjdk1.8.0_271/jre/lib/oblique-fonts/LucidaSansOblique.ttfjdk1.8.0_271/jre/lib/oblique-fonts/fonts.dirjdk1.8.0_271/jre/lib/oblique-fonts/LucidaSansDemiOblique.ttfjdk1.8.0_271/jre/lib/fontconfig.SuSE.10.properties.srcjdk1.8.0_271/jre/lib/images/jdk1.8.0_271/jre/lib/images/cursors/jdk1.8.0_271/jre/lib/images/cursors/motif_CopyNoDrop32x32.gifjdk1.8.0_271/jre/lib/images/cursors/motif_LinkDrop32x32.gifjdk1.8.0_271/jre/lib/images/cursors/motif_MoveNoDrop32x32.gifjdk1.8.0_271/jre/lib/images/cursors/motif_CopyDrop32x32.gifjdk1.8.0_271/jre/lib/images/cursors/motif_MoveDrop32x32.gifjdk1.8.0_271/jre/lib/images/cursors/cursors.propertiesjdk1.8.0_271/jre/lib/images/cursors/invalid32x32.gifjdk1.8.0_271/jre/lib/images/cursors/motif_LinkNoDrop32x32.gifjdk1.8.0_271/jre/lib/fontconfig.RedHat.5.bfcjdk1.8.0_271/jre/lib/security/jdk1.8.0_271/jre/lib/security/blacklisted.certsjdk1.8.0_271/jre/lib/security/trusted.librariesjdk1.8.0_271/jre/lib/security/blacklistjdk1.8.0_271/jre/lib/security/java.securityjdk1.8.0_271/jre/lib/security/policy/jdk1.8.0_271/jre/lib/security/policy/limited/jdk1.8.0_271/jre/lib/security/policy/limited/US_export_policy.jarjdk1.8.0_271/jre/lib/security/policy/limited/local_policy.jarjdk1.8.0_271/jre/lib/security/policy/unlimited/jdk1.8.0_271/jre/lib/security/policy/unlimited/local_policy.jarjdk1.8.0_271/jre/lib/security/policy/unlimited/US_export_policy.jarjdk1.8.0_271/jre/lib/security/cacertsjdk1.8.0_271/jre/lib/security/java.policyjdk1.8.0_271/jre/lib/fontconfig.bfcjdk1.8.0_271/jre/lib/jsse.jarjdk1.8.0_271/jre/lib/fontconfig.SuSE.11.properties.srcjdk1.8.0_271/jre/lib/fontconfig.RedHat.6.bfcjdk1.8.0_271/jre/lib/aarch64/jdk1.8.0_271/jre/lib/aarch64/libj2gss.sojdk1.8.0_271/jre/lib/aarch64/libjfr.sojdk1.8.0_271/jre/lib/aarch64/libhprof.sojdk1.8.0_271/jre/lib/aarch64/libawt_headless.sojdk1.8.0_271/jre/lib/aarch64/libj2pcsc.sojdk1.8.0_271/jre/lib/aarch64/libjpeg.sojdk1.8.0_271/jre/lib/aarch64/libbci.sojdk1.8.0_271/jre/lib/aarch64/libjava_crw_demo.sojdk1.8.0_271/jre/lib/aarch64/libjsig.sojdk1.8.0_271/jre/lib/aarch64/libresource.sojdk1.8.0_271/jre/lib/aarch64/libattach.sojdk1.8.0_271/jre/lib/aarch64/libsctp.sojdk1.8.0_271/jre/lib/aarch64/libawt.sojdk1.8.0_271/jre/lib/aarch64/libzip.sojdk1.8.0_271/jre/lib/aarch64/libjava.sojdk1.8.0_271/jre/lib/aarch64/libjawt.sojdk1.8.0_271/jre/lib/aarch64/libjdwp.sojdk1.8.0_271/jre/lib/aarch64/libmanagement.sojdk1.8.0_271/jre/lib/aarch64/libfontmanager.sojdk1.8.0_271/jre/lib/aarch64/libjsoundalsa.sojdk1.8.0_271/jre/lib/aarch64/liblcms.sojdk1.8.0_271/jre/lib/aarch64/server/jdk1.8.0_271/jre/lib/aarch64/server/libjvm.sojdk1.8.0_271/jre/lib/aarch64/server/libjsig.sojdk1.8.0_271/jre/lib/aarch64/server/Xusage.txtjdk1.8.0_271/jre/lib/aarch64/libjsound.sojdk1.8.0_271/jre/lib/aarch64/libinstrument.sojdk1.8.0_271/jre/lib/aarch64/libdcpr.sojdk1.8.0_271/jre/lib/aarch64/libsunec.sojdk1.8.0_271/jre/lib/aarch64/libnio.sojdk1.8.0_271/jre/lib/aarch64/libjaas_unix.sojdk1.8.0_271/jre/lib/aarch64/libt2k.sojdk1.8.0_271/jre/lib/aarch64/libunpack.sojdk1.8.0_271/jre/lib/aarch64/libjsdt.sojdk1.8.0_271/jre/lib/aarch64/libawt_xawt.sojdk1.8.0_271/jre/lib/aarch64/libnpt.sojdk1.8.0_271/jre/lib/aarch64/libnet.sojdk1.8.0_271/jre/lib/aarch64/jli/jdk1.8.0_271/jre/lib/aarch64/jli/libjli.sojdk1.8.0_271/jre/lib/aarch64/libj2pkcs11.sojdk1.8.0_271/jre/lib/aarch64/libmlib_image.sojdk1.8.0_271/jre/lib/aarch64/libsaproc.sojdk1.8.0_271/jre/lib/aarch64/libsplashscreen.sojdk1.8.0_271/jre/lib/aarch64/jvm.cfgjdk1.8.0_271/jre/lib/aarch64/libverify.sojdk1.8.0_271/jre/lib/aarch64/libdt_socket.sojdk1.8.0_271/jre/lib/logging.propertiesjdk1.8.0_271/jre/lib/management-agent.jarjdk1.8.0_271/jre/lib/fontconfig.Turbo.bfcjdk1.8.0_271/jre/lib/meta-indexjdk1.8.0_271/jre/lib/fonts/jdk1.8.0_271/jre/lib/fonts/LucidaTypewriterRegular.ttfjdk1.8.0_271/jre/lib/fonts/LucidaTypewriterBold.ttfjdk1.8.0_271/jre/lib/fonts/LucidaBrightDemiBold.ttfjdk1.8.0_271/jre/lib/fonts/LucidaSansDemiBold.ttfjdk1.8.0_271/jre/lib/fonts/LucidaSansRegular.ttfjdk1.8.0_271/jre/lib/fonts/fonts.dirjdk1.8.0_271/jre/lib/fonts/LucidaBrightRegular.ttfjdk1.8.0_271/jre/lib/fonts/LucidaBrightItalic.ttfjdk1.8.0_271/jre/lib/fonts/LucidaBrightDemiItalic.ttfjdk1.8.0_271/jre/lib/jfr.jarjdk1.8.0_271/jre/lib/jvm.hprof.txtjdk1.8.0_271/jre/lib/classlistjdk1.8.0_271/jre/lib/hijrah-config-umalqura.propertiesjdk1.8.0_271/jre/lib/sound.propertiesjdk1.8.0_271/jre/lib/cmm/jdk1.8.0_271/jre/lib/cmm/CIEXYZ.pfjdk1.8.0_271/jre/lib/cmm/LINEAR_RGB.pfjdk1.8.0_271/jre/lib/cmm/GRAY.pfjdk1.8.0_271/jre/lib/cmm/PYCC.pfjdk1.8.0_271/jre/lib/cmm/sRGB.pfjdk1.8.0_271/jre/lib/calendars.propertiesjdk1.8.0_271/jre/lib/resources.jarjdk1.8.0_271/jre/lib/ext/jdk1.8.0_271/jre/lib/ext/zipfs.jarjdk1.8.0_271/jre/lib/ext/dnsns.jarjdk1.8.0_271/jre/lib/ext/cldrdata.jarjdk1.8.0_271/jre/lib/ext/localedata.jarjdk1.8.0_271/jre/lib/ext/sunpkcs11.jarjdk1.8.0_271/jre/lib/ext/jaccess.jarjdk1.8.0_271/jre/lib/ext/sunjce_provider.jarjdk1.8.0_271/jre/lib/ext/sunec.jarjdk1.8.0_271/jre/lib/ext/meta-indexjdk1.8.0_271/jre/lib/ext/nashorn.jarjdk1.8.0_271/jre/lib/jfr/jdk1.8.0_271/jre/lib/jfr/profile.jfcjdk1.8.0_271/jre/lib/jfr/default.jfcjdk1.8.0_271/jre/lib/management/jdk1.8.0_271/jre/lib/management/jmxremote.accessjdk1.8.0_271/jre/lib/management/snmp.acl.templatejdk1.8.0_271/jre/lib/management/management.propertiesjdk1.8.0_271/jre/lib/management/jmxremote.password.templatejdk1.8.0_271/jre/lib/fontconfig.RedHat.5.properties.srcjdk1.8.0_271/jre/lib/jexecjdk1.8.0_271/jre/lib/charsets.jarjdk1.8.0_271/jre/lib/tzdb.datjdk1.8.0_271/jre/legal/jdk1.8.0_271/jre/legal/jdk/jdk1.8.0_271/jre/legal/jdk/libxrandr.mdjdk1.8.0_271/jre/legal/jdk/relaxngom.mdjdk1.8.0_271/jre/legal/jdk/unicode.mdjdk1.8.0_271/jre/legal/jdk/relaxngcc.mdjdk1.8.0_271/jre/legal/jdk/santuario.mdjdk1.8.0_271/jre/legal/jdk/joni.mdjdk1.8.0_271/jre/legal/jdk/dom.mdjdk1.8.0_271/jre/legal/jdk/ecc.mdjdk1.8.0_271/jre/legal/jdk/xerces.mdjdk1.8.0_271/jre/legal/jdk/cldr.mdjdk1.8.0_271/jre/legal/jdk/bcel.mdjdk1.8.0_271/jre/legal/jdk/thaidict.mdjdk1.8.0_271/jre/legal/jdk/relaxngdatatype.mdjdk1.8.0_271/jre/legal/jdk/xwd.mdjdk1.8.0_271/jre/legal/jdk/jopt-simple.mdjdk1.8.0_271/jre/legal/jdk/asm.mdjdk1.8.0_271/jre/legal/jdk/giflib.mdjdk1.8.0_271/jre/legal/jdk/xorgproto.mdjdk1.8.0_271/jre/legal/jdk/libpng.mdjdk1.8.0_271/jre/legal/jdk/dynalink.mdjdk1.8.0_271/jre/legal/jdk/icu.mdjdk1.8.0_271/jre/legal/jdk/xalan.mdjdk1.8.0_271/jre/legal/jdk/cryptix.mdjdk1.8.0_271/jre/legal/jdk/pkcs11wrapper.mdjdk1.8.0_271/jre/legal/jdk/freebxml.mdjdk1.8.0_271/jre/legal/jdk/xmlresolver.mdjdk1.8.0_271/jre/legal/jdk/lcms.mdjdk1.8.0_271/jre/legal/jdk/pcsclite.mdjdk1.8.0_271/jre/legal/jdk/jcup.mdjdk1.8.0_271/jre/legal/jdk/zlib.mdjdk1.8.0_271/jre/legal/jdk/mesa3d.mdjdk1.8.0_271/jre/legal/jdk/jpeg.mdjdk1.8.0_271/jre/legal/jdk/colorimaging.mdjdk1.8.0_271/jre/legal/jdk/pkcs11cryptotoken.mdjdk1.8.0_271/jre/LICENSEjdk1.8.0_271/jre/READMEjdk1.8.0_271/jre/Welcome.htmljdk1.8.0_271/legal/jdk1.8.0_271/legal/jdk/jdk1.8.0_271/legal/jdk/mesa3d.mdjdk1.8.0_271/legal/jdk/colorimaging.mdjdk1.8.0_271/legal/jdk/cldr.mdjdk1.8.0_271/legal/jdk/bcel.mdjdk1.8.0_271/legal/jdk/pkcs11wrapper.mdjdk1.8.0_271/legal/jdk/jopt-simple.mdjdk1.8.0_271/legal/jdk/xalan.mdjdk1.8.0_271/legal/jdk/pcsclite.mdjdk1.8.0_271/legal/jdk/pkcs11cryptotoken.mdjdk1.8.0_271/legal/jdk/unicode.mdjdk1.8.0_271/legal/jdk/freebxml.mdjdk1.8.0_271/legal/jdk/joni.mdjdk1.8.0_271/legal/jdk/libpng.mdjdk1.8.0_271/legal/jdk/dynalink.mdjdk1.8.0_271/legal/jdk/relaxngcc.mdjdk1.8.0_271/legal/jdk/zlib.mdjdk1.8.0_271/legal/jdk/dom.mdjdk1.8.0_271/legal/jdk/libxrandr.mdjdk1.8.0_271/legal/jdk/relaxngdatatype.mdjdk1.8.0_271/legal/jdk/relaxngom.mdjdk1.8.0_271/legal/jdk/giflib.mdjdk1.8.0_271/legal/jdk/jpeg.mdjdk1.8.0_271/legal/jdk/thaidict.mdjdk1.8.0_271/legal/jdk/xerces.mdjdk1.8.0_271/legal/jdk/santuario.mdjdk1.8.0_271/legal/jdk/icu.mdjdk1.8.0_271/legal/jdk/cryptix.mdjdk1.8.0_271/legal/jdk/jcup.mdjdk1.8.0_271/legal/jdk/ecc.mdjdk1.8.0_271/legal/jdk/xmlresolver.mdjdk1.8.0_271/legal/jdk/xwd.mdjdk1.8.0_271/legal/jdk/lcms.mdjdk1.8.0_271/legal/jdk/asm.mdjdk1.8.0_271/legal/jdk/xorgproto.mdjdk1.8.0_271/lib/jdk1.8.0_271/lib/ct.symjdk1.8.0_271/lib/jexecjdk1.8.0_271/lib/orb.idljdk1.8.0_271/lib/sa-jdi.jarjdk1.8.0_271/lib/ir.idljdk1.8.0_271/lib/tools.jarjdk1.8.0_271/lib/aarch64/jdk1.8.0_271/lib/aarch64/libjawt.sojdk1.8.0_271/lib/aarch64/jli/jdk1.8.0_271/lib/aarch64/jli/libjli.sojdk1.8.0_271/lib/dt.jarjdk1.8.0_271/lib/jconsole.jarjdk1.8.0_271/man/jdk1.8.0_271/man/ja_JP.UTF-8/jdk1.8.0_271/man/ja_JP.UTF-8/man1/jdk1.8.0_271/man/ja_JP.UTF-8/man1/jarsigner.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/tnameserv.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/javap.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jar.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/java.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jhat.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/xjc.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jdeps.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jstatd.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/keytool.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/javadoc.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jvisualvm.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jsadebugd.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/rmiregistry.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/rmic.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jmap.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/javaws.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/servertool.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jps.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/schemagen.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/pack200.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/appletviewer.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/wsgen.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/javac.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/idlj.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jinfo.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/javah.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jdb.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/unpack200.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/wsimport.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/policytool.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/extcheck.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jstat.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jcmd.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/rmid.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jconsole.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jrunscript.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/native2ascii.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/orbd.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jjs.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/jstack.1jdk1.8.0_271/man/ja_JP.UTF-8/man1/serialver.1jdk1.8.0_271/man/man1/jdk1.8.0_271/man/man1/jstack.1jdk1.8.0_271/man/man1/jarsigner.1jdk1.8.0_271/man/man1/tnameserv.1jdk1.8.0_271/man/man1/jstat.1jdk1.8.0_271/man/man1/java.1jdk1.8.0_271/man/man1/jhat.1jdk1.8.0_271/man/man1/pack200.1jdk1.8.0_271/man/man1/servertool.1jdk1.8.0_271/man/man1/jjs.1jdk1.8.0_271/man/man1/javadoc.1jdk1.8.0_271/man/man1/keytool.1jdk1.8.0_271/man/man1/native2ascii.1jdk1.8.0_271/man/man1/jinfo.1jdk1.8.0_271/man/man1/jsadebugd.1jdk1.8.0_271/man/man1/rmic.1jdk1.8.0_271/man/man1/javac.1jdk1.8.0_271/man/man1/jmap.1jdk1.8.0_271/man/man1/jvisualvm.1jdk1.8.0_271/man/man1/wsgen.1jdk1.8.0_271/man/man1/jdb.1jdk1.8.0_271/man/man1/rmiregistry.1jdk1.8.0_271/man/man1/schemagen.1jdk1.8.0_271/man/man1/javah.1jdk1.8.0_271/man/man1/javaws.1jdk1.8.0_271/man/man1/extcheck.1jdk1.8.0_271/man/man1/appletviewer.1jdk1.8.0_271/man/man1/jrunscript.1jdk1.8.0_271/man/man1/jps.1jdk1.8.0_271/man/man1/idlj.1jdk1.8.0_271/man/man1/unpack200.1jdk1.8.0_271/man/man1/jconsole.1jdk1.8.0_271/man/man1/javap.1jdk1.8.0_271/man/man1/jstatd.1jdk1.8.0_271/man/man1/orbd.1jdk1.8.0_271/man/man1/jar.1jdk1.8.0_271/man/man1/jcmd.1jdk1.8.0_271/man/man1/rmid.1jdk1.8.0_271/man/man1/jdeps.1jdk1.8.0_271/man/man1/wsimport.1jdk1.8.0_271/man/man1/xjc.1jdk1.8.0_271/man/man1/serialver.1jdk1.8.0_271/man/man1/policytool.1jdk1.8.0_271/man/jajdk1.8.0_271/releasejdk1.8.0_271/src.ziproot@localhost:~/java_dev# vim /etc/profileroot
 @localhost:~/java_dev# source /etc/profile
 root@localhost:~/java_dev# update-alternatives --display java


java - 自动模式 最佳链接版本为

/usr/lib/jvm/jdk1.8.0_202/bin/java 链接目前指向 /usr/lib/jvm/jdk1.8.0_202/bin/java 链接 java 指向 /usr/bin/java/usr/lib/jvm/jdk1.8.0_202/bin/java - 优先级 300
 root@localhost:~/java_dev# update-alternatives --remove-all javaroot@localhost:~/java_dev# update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_271/bin/java 300update-alternatives: 使用 /usr/lib/jvm/jdk1.8.0_271/bin/java 来在自动模式中提供 /usr/bin/java (java)
 root@localhost:~/java_dev# java -versionjava version "1.8.0_271"Java™ SE Runtime Environment (build 1.8.0_271-b09)Java HotSpot™ 64-Bit Server VM (build 25.271-b09, mixed mode)
 root@localhost:~/java_dev# update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_271/bin/javac 300
 root@localhost:~/java_dev# update-alternatives --remove-all javacroot@localhost:~/java_dev# update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_271/bin/javac 300
 update-alternatives: 使用 /usr/lib/jvm/jdk1.8.0_271/bin/javac 来在自动模式中提供 /usr/bin/javac (javac)