Centos 8安装Java 11 (OpenJDK 11) 与环境变量配置 – sky8g网站

您所在的位置:网站首页 openjdk11安装 Centos 8安装Java 11 (OpenJDK 11) 与环境变量配置 – sky8g网站

Centos 8安装Java 11 (OpenJDK 11) 与环境变量配置 – sky8g网站

2022-05-28 07:41| 来源: 网络整理| 查看: 265

我们使用cordova的时候需要安装其他的应用依赖,在进行环境检查的时候出现如下:

1234567891011121314151617181920 [root@localhost myapp]# cordova requirements Requirements check results for android:Java JDK: not installed Failed to find 'JAVA_HOME' environment variable. Try setting it manually.Android SDK: not installed Failed to find 'ANDROID_SDK_ROOT' environment variable. Try setting it manually.Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.Android target: not installed Command failed with ENOENT: android list targetspawn android ENOENTGradle: not installed Could not find gradle wrapper within Android SDK. Could not find Android SDK directory.Might need to install Android SDK or set up 'ANDROID_SDK_ROOT' env variable. Requirements check results for ios:Apple macOS: not installed Error: Cordova tooling for iOS requires Apple macOSSome of requirements check failed[root@localhost myapp]#

通过上面我们可以知道java jdk并没有安装,这个时候我们需要安装java jdk。

第一步:我们检查下环境系统,在这里我们以centos为例。

12 [root@localhost ~]# cat /etc/system-releaseCentOS Linux release 8.2.2004 (Core)

 第二步:我们得知时centos 8,在centos 8系统中推荐使用dnf来代替yum安装,至于为什么centos8这样做,你可以百度一下,这里不再赘述。

OpenJDK是一个免费和开源的Java平台实现,根据GNU通用公共许可证版本2授权的标准版本。通过下面的命令我们可以看到安装的java 11.

1 sudo dnf install java-11-openjdk-devel

12345 [root@localhost myapp]# java -versionopenjdk version "11.0.9.1" 2020-11-04 LTSOpenJDK Runtime Environment 18.9 (build 11.0.9.1+1-LTS)OpenJDK 64-Bit Server VM 18.9 (build 11.0.9.1+1-LTS, mixed mode, sharing)[root@localhost myapp]#

第三步:查看java的安装位置

123 [root@localhost myapp]# which java/usr/bin/java[root@localhost myapp]#

第四步:配置java环境变量。

12345 cat > /etc/profile.d/java11.sh


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3