chenzhao

  • java
  • iOS
  • IT
知识积累
不积跬步无以至千里
  1. 首页
  2. IT
  3. 正文

CentOS 7 安装JDK 1.8 环境教程

2023年 1月 19日 60点热度 0人点赞 0条评论

CentOS 7 安装JDK 1.8 环境教程

CentOS 7 安装JDK 1.8 环境教程

Timber 8,345 2020-12-08

方法一:使用yum安装jdk环环境

1.查看云端yum库中目前支持安装的jdk软件包

yum search java|grep jdk 

11115.png

2.选择版本安装jdk

 yum install -y java-1.8.0-openjdk* 

3.安装完成后,验证是否安装成功

java -version 

版本.png

4.查找jdk安装位置

find / -name 'java' 

image.png

默认安装路径一般为:
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-5.b12.el7_4.x86_64/jre/bin/java

方法二:从Oracle获取安装包,手动安装

1.从Oracle官网中获取jdk安装包

本案例使用jdk8演示

下载地址:https://www.oracle.com/cn/java/technologies/javase-downloads.html

image.png

根据系统版本和位数选择tar.gz

image.png

复制下载链接

image.png

https://download.oracle.com/otn-pub/java/jdk/8.0.1+9/51f4f36ad4ef43e39d0dfdbaf6549e32/jdk-8.0.1_linux-x64_bin.tar.gz

创建文件夹,使用wget命令获取安装包

mkdir /usr/java
cd /usr/java
wget https://download.oracle.com/otn/java/jdk/8u271-b09/61ae65e0886 

等待下载

image.png

2.解压安装jdk

使用tar命令解压安装包

tar zxvf jdk-8.0.1_linux-x64_bin.tar.gz 

3.配置系统环境变量

用Vim打开profile

vim /etc/profile 

在文档末尾此处添加系统环境变量

image.png

键盘上按i键进入编写

export JAVA_HOME=/usr/share/jdk1.6.0_14
export PATH=JAVA_HOME/bin:PATH
export CLASSPATH=.:JAVA_HOME/lib/dt.jar:JAVA_HOME/lib/tools.jar 

注意:JAVA_HOME的路径是你实际解压后的JDK的路径

按esc退出编辑模式,再按shift+Q输入x保存

输入命令使profile生效

source /etc/profile 

4.安装完成后,验证是否安装成功

java -version 

版本.png


Linux


JavaWeb应用开发课程登录案例作业实现文档F3EYR@G9@0N50%7BKDB4$A-fa998b9484894701a8d9c5a25e03dc1e.png) 上一篇

JavaWeb应用开发课程登录案例作业实现文档

request和response的工作原理简介 下一篇

request和response的工作原理简介

function renderComment() { var haloComment = document.getElementById('haloComment12'); if (!haloComment) { ('#' + '12').remove();('#commentInner12').append('

'); } if (!localStorage.theme) { localStorage.setItem('theme', 'light') } if (typeof Vue = "undefined") { // console.error('Vue is not defined') return } new Vue({ el: '#haloComment12', data() { return { configs: { darkMode: localStorage.getItem('theme') = 'dark' } }; }, template: ``, }); } renderComment();

window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-VMNYMKZN9K');

Powered Halo

Theme Xue

运行

function initComment() { ('script[data-pjax-comment]').each(function () { const commentParent =(this).parent(); const comment = $(this).remove(); commentParent.append(comment); }); } var configs = { autoLoad: true, showUserAgent: true, darkMode: localStorage.getItem('dark') = 'dark' } function renderTagCloud() { // 标签云 var tagCloud = $("#tagCloud"); if (!(tagCloud && tagCloud.children().length = 0)) { return; } // 标签 var tagArray = [ { 'text': '哲学', 'weight': '2', 'link': 'https://timberkito.com/tags/philosophy' }, { 'text': '大学计算机', 'weight': '9', 'link': 'https://timberkito.com/tags/computer' }, { 'text': 'Python', 'weight': '1', 'link': 'https://timberkito.com/tags/python' }, { 'text': 'Vue', 'weight': '2', 'link': 'https://timberkito.com/tags/vue' }, { 'text': '文档', 'weight': '6', 'link': 'https://timberkito.com/tags/docs' }, { 'text': 'Linux', 'weight': '3', 'link': 'https://timberkito.com/tags/linux' }, { 'text': 'MySql', 'weight': '0', 'link': 'https://timberkito.com/tags/mysql' }, { 'text': 'JavaWeb', 'weight': '12', 'link': 'https://timberkito.com/tags/javaweb' }, { 'text': '生活', 'weight': '0', 'link': 'https://timberkito.com/tags/life' }, ]; // 标签云 tagCloud.jQCloud(tagArray, {autoResize: true, delayedMode: true}); } function renderCategoryCloud() { // 分类云 var categoryCloud = $("#categoryCloud"); if (!(categoryCloud && categoryCloud.children().length = 0)) { return; } // 分类 var array = [ { 'text': 'Java', 'weight': '12', 'link': 'https://timberkito.com/categories/java' }, { 'text': '生活随笔', 'weight': '0', 'link': 'https://timberkito.com/categories/生活随笔' }, { 'text': 'MySql', 'weight': '0', 'link': 'https://timberkito.com/categories/mysql' }, { 'text': 'Linux系统', 'weight': '4', 'link': 'https://timberkito.com/categories/linux' }, { 'text': 'Python', 'weight': '1', 'link': 'https://timberkito.com/categories/python' }, { 'text': '文档', 'weight': '6', 'link': 'https://timberkito.com/categories/docs' }, { 'text': '前端', 'weight': '5', 'link': 'https://timberkito.com/categories/qianduan' }, { 'text': '大学计算机', 'weight': '9', 'link': 'https://timberkito.com/categories/cqzsbpc' }, { 'text': '哲学', 'weight': '2', 'link': 'https://timberkito.com/categories/philosophy' }, ]; categoryCloud.jQCloud(array, {autoResize: true, delayedMode: true}); } const loadingGif = 'https://timberkito.com/themes/bao/source/images/loading.gif'; // console.clear(); console.log("%c 有朋自远方来, 不亦说乎.", "background:#24272A; color:#ffffff", ""); console.log("%c Github %c", "background:#24272A; color:#ffffff", "", "https://github.com/TimberKito"); const loading = "https://timberkito.com/themes/bao/source/images/loading-45.svg"; var photoList = ``; var photos = new Array(); if (photoList && photoList.trim() ! '') { if(photoList.endsWith(';')) { photoList = photoList.substring(0, photoList.length - 1); } var photoArr = photoList.split(";"); // 过滤photos中的空字符 for(let i = 0; i < photoArr.length; i++) { if (photoArr[i] && photoArr[i].trim().length > 0){ photos.push(photoArr[i].trim()); } } // 随机排列图片 for (let index = 0; index < photos.length; index++) { let randomIndex = Math.floor(Math.random() * photos.length); let temp = photos[randomIndex]; photos[randomIndex] = photos[index]; photos[index] = temp; } } // 建站时间统计 function show_date_time() { if (("#span_dt_dt").length > 0) { BirthDay = new Date("11/17/2020 11:44:00"); today = new Date(); timeold = (today.getTime() - BirthDay.getTime()); sectimeold = timeold / 1000; secondsold = Math.floor(sectimeold); msPerDay = 24 * 60 * 60 * 1000; e_daysold = timeold / msPerDay; daysold = Math.floor(e_daysold); e_hrsold = (e_daysold - daysold) * 24; hrsold = Math.floor(e_hrsold); e_minsold = (e_hrsold - hrsold) * 60; minsold = Math.floor((e_hrsold - hrsold) * 60); seconds = Math.floor((e_minsold - minsold) * 60); span_dt_dt.innerHTML = daysold + "天" + hrsold + "小时" + minsold + "分" + seconds + "秒"; } } setInterval("show_date_time()","1000");(document).pjax( 'a[href]:not([href^="#"]):not([data-not-pjax]):not([target^="_blank"]), form', '#container', {fragment: '#container', timeout: 8000}); (document).on('pjax:send', function () { NProgress.start(); })(document).on('pjax:complete', function () { NProgress.done(); xueContext.wrapImage(); xueContext.handleNavActive(); xueContext.handleNavTheme() // 切换页面后,要隐藏菜单 ('.mobile-sidebar').removeClass('active')('.non-click-bg').addClass('hidden') // 重新加载 评论 ('script[data-pjax-comment]').each(function () { const commentParent =(this).parent(); const comment = (this).remove(); commentParent.append(comment); }); // 存在 markdown 页面的功能 if (("#container").find('.md-content').length > 0) { // 高亮代码 xueContext.highlightCode() // 滚动动画 xueContext.reveal() // 目录相关 if (typeof tocbot ! "undefined" && document.getElementById("toc")) { xueContext.handleContentToc(); } } // 日志 if (("#container").find('#journals').length > 0) { xueContext.journalModal() xueContext.createTimeAgo() } // arrow down if (("#container").find('.arrow-down').length > 0) { xueContext.arrowDown() } if (("#container").find('.share-items').length > 0) { xueContext.shareBtn() xueContext.shareItem() } // alipay if (("#container").find('#alipay').length > 0) { xueContext.toggleAlipay() } // wechat if (("#container").find('#wechat').length > 0) { xueContext.toggleWeChat() } // 获取更多 if (("#container").find('.more-btn').length > 0) { xueContext.moreBtn() } // 喜欢 if (("#container").find('.like-btn').length > 0) { xueContext.likeBtn() } // 分页 if (("#container").find('.pagination-circle').length > 0) { xueContext.pageBtn() } // 相册页面功能 if ($("#container").find('.photos-page').length > 0) { xueContext.gallery() } // 图片懒加载 xueContext.lazyloadImage() //重载 if (typeof _hmt ! 'undefined') { // support 百度统计 _hmt.push(['_trackPageview', location.pathname + location.search]); } if (typeof ga ! 'undefined') { // support google analytics ga('send', 'pageview', location.pathname + location.search); } if (('#container').find('.jqcloud').length > 0) { renderTagCloud(); renderCategoryCloud(); } ; });(document).on('pjax:error', function () { NProgress.done(); });

本文转自 https://timberkito.com/?p=12,如有侵权,请联系删除。

标签: 暂无
最后更新:2023年 1月 19日

陈昭

IT 程序员

打赏 点赞
< 上一篇
下一篇 >

文章评论

取消回复

COPYRIGHT © 2022 chenzhao. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang