linux 安装JDK的方法分享
转自:
http://www.java265.com/JavaCourse/202201/2242.html
JDK的功能:
JDK是 Java 语言的软件开发工具包,主要用于移动设备、嵌入式设备上的java应用程序。JDK是整个java开发的核心,它包含了JAVA的运行环境(JVM+Java系统类库)和JAVA工具。
JDK(Java Development Kit) 是 Java 语言的软件开发工具包(SDK)。
SE(JavaSE),standard edition,标准版,是我们通常用的一个版本,从JDK 5.0开始,改名为Java SE。
EE(JavaEE),enterprise edition,企业版,使用这种JDK开发J2EE应用程序,从JDK 5.0开始,改名为Java EE。从2018年2月26日开始,J2EE改名为Jakarta EE [1] 。
ME(J2ME),micro edition,主要用于移动设备、嵌入式设备上的java应用程序,从JDK 5.0开始,改名为Java ME。
没有JDK的话,无法编译Java程序(指java源码.java文件),如果想只运行Java程序(指class或jar或其它归档文件),要确保已安装相应的JRE。
傻瓜安装方式分享
步骤一:获取java版本
[root@localhost opt]# yum -y list java* 已加载插件:fastestmirror Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.dgut.edu.cn 可安装的软件包 java-1.6.0-openjdk.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base java-1.6.0-openjdk-demo.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base java-1.6.0-openjdk-devel.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base java-1.6.0-openjdk-javadoc.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base java-1.6.0-openjdk-src.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base java-1.7.0-openjdk.x86_64 1:1.7.0.261-2.6.22.2.el7_8 base java-1.7.0-openjdk-accessibility.x86_64 1:1.7.0.261-2.6.22.2.el7_8 base java-1.7.0-openjdk-demo.x86_64 1:1.7.0.261-2.6.22.2.el7_8 base java-1.7.0-openjdk-devel.x86_64 1:1.7.0.261-2.6.22.2.el7_8 base java-1.7.0-openjdk-headless.x86_64 1:1.7.0.261-2.6.22.2.el7_8 base java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.261-2.6.22.2.el7_8 base java-1.7.0-openjdk-src.x86_64 1:1.7.0.261-2.6.22.2.el7_8 base java-1.8.0-openjdk.i686 1:1.8.0.312.b07-1.el7_9 updates java-1.8.0-openjdk.x86_64 1:1.8.0.312.b07-1.el7_9 updates java-1.8.0-openjdk-accessibility.i686 1:1.8.0.312.b07-1.el7_9 updates java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.312.b07-1.el7_9 updates java-1.8.0-openjdk-demo.i686 1:1.8.0.312.b07-1.el7_9 updates java-1.8.0-openjdk-demo.x86_64 1:1.8.0.312.b07-1.el7_9 updates java-1.8.0-openjdk-devel.i686 1:1.8.0.312.b07-1.el7_9 updates java-1.8.0-openjdk-devel.x86_64 1:1.8.0.312.b07-1.el7_9 updates java-1.8.0-openjdk-headless.i686 1:1.8.0.312.b07-1.el7_9 updates java-1.8.0-openjdk-headless.x86_64 1:1.8.0.312.b07-1.el7_9 updates java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.312.b07-1.el7_9 updates java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.312.b07-1.el7_9 updates java-1.8.0-openjdk-src.i686 1:1.8.0.312.b07-1.el7_9 updates java-1.8.0-openjdk-src.x86_64 1:1.8.0.312.b07-1.el7_9 updates java-11-openjdk.i686 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk.x86_64 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-demo.i686 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-demo.x86_64 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-devel.i686 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-devel.x86_64 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-headless.i686 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-headless.x86_64 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-javadoc.i686 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-javadoc.x86_64 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-javadoc-zip.i686 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-javadoc-zip.x86_64 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-jmods.i686 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-jmods.x86_64 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-src.i686 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-src.x86_64 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-static-libs.i686 1:11.0.13.0.8-1.el7_9 updates java-11-openjdk-static-libs.x86_64 1:11.0.13.0.8-1.el7_9 updates java-atk-wrapper.i686 0.30.4-5.el7 base java-atk-wrapper.x86_64 0.30.4-5.el7 base java_cup.noarch 1:0.11a-16.el7 base java_cup-javadoc.noarch 1:0.11a-16.el7 base java_cup-manual.noarch 1:0.11a-16.el7 base javacc.noarch 5.0-10.el7 base javacc-demo.noarch 5.0-10.el7 base javacc-javadoc.noarch 5.0-10.el7 base javacc-manual.noarch 5.0-10.el7 base javacc-maven-plugin.noarch 2.6-17.el7 base javacc-maven-plugin-javadoc.noarch 2.6-17.el7 base javamail.noarch 1.4.6-8.el7 base javamail-javadoc.noarch 1.4.6-8.el7 base javapackages-tools.noarch 3.4.1-11.el7 base javassist.noarch 3.16.1-10.el7 base javassist-javadoc.noarch 3.16.1-10.el7 base [root@localhost opt]#
选择指定的java版本进行安装
[root@localhost opt]# yum install -y java-1.8.0-openjdk-devel.x86_64 已加载插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.dgut.edu.cn base
使用以上两种方式,即可实现傻瓜的linux jdk安装