本篇内容介绍了“Ubuntu下怎么安装JDK 1.8”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
在陇西等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站设计、成都做网站 网站设计制作按需求定制制作,公司网站建设,企业网站建设,成都品牌网站建设,成都全网营销,外贸营销网站建设,陇西网站建设费用合理。
Ubuntu14.04 LTS下安装JDK 1.8
先到Oracle官网的下载中心下载JDK8的tar包到本地。
创建应用程序主目录
linuxidc@ubuntu:/usr/lib$ sudo mkdir jvm
解压下载的tar包到应用程序主目录下
linuxidc@ubuntu:~/Downloads$ sudo tar zxf jdk-8u65-linux-x64.tar.gz -C /usr/lib/jvm
重命名下文件夹
linuxidc@ubuntu:/usr/lib/jvm$ sudo mv jdk1.8.0_65 java
安装vim(因为UBuntu默认情况下不安装vim命令,需要用apt-get命令安装)
linuxidc@ubuntu:/usr/lib/jvm/java$sudoapt-getinstallvim Readingpackagelists...Done Buildingdependencytree Readingstateinformation...Done Thefollowingextrapackageswillbeinstalled: vim-runtime Suggestedpackages: ctagsvim-docvim-scripts ThefollowingNEWpackageswillbeinstalled: vimvim-runtime 0upgraded,2newlyinstalled,0toremoveand6notupgraded. Needtoget5,844kBofarchives. Afterthisoperation,28.0MBofadditionaldiskspacewillbeused. Doyouwanttocontinue?[Y/n]y Get:1http://us.archive.ubuntu.com/ubuntu/trusty/mainvim-runtimeall2:7.4.052-1ubuntu3[4,888kB] Get:2http://us.archive.ubuntu.com/ubuntu/trusty/mainvimamd642:7.4.052-1ubuntu3[956kB] Fetched5,844kBin18min52s(5,159B/s)
配置环境变量,vim ~/.bashrc文件
linuxidc@ubuntu:/usr/lib/jvm/java$ sudo vim ~/.bashrc
添加下面的内容到文件尾部
exportJAVA_HOME=/usr/lib/jvm/java exportJRE_HOME=${JAVA_HOME}/jre exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib exportPATH=${JAVA_HOME}/bin:$PATH
如果你的Ubuntu上已经安装了其他版本的JDK,你可以通过update-alternatives命令来设定比如命令Java的默认命令路径。然后就是编译下让update-alternatives配置生效。
linuxidc@ubuntu:/usr/lib/jvm/java$sudoupdate-alternatives--install/usr/bin/javajava/usr/lib/jvm/java/bin/java300 update-alternatives:using/usr/lib/jvm/java/bin/javatoprovide/usr/bin/java(java)inautomode linuxidc@ubuntu:/usr/lib/jvm/java$sudoupdate-alternatives--install/usr/bin/javacjavac/usr/lib/jvm/java/bin/javac300 update-alternatives:using/usr/lib/jvm/java/bin/javactoprovide/usr/bin/javac(javac)inautomode linuxidc@ubuntu:/usr/lib/jvm/java$sudoupdate-alternatives--install/usr/bin/jarjar/usr/lib/jvm/java/bin/jar300 update-alternatives:using/usr/lib/jvm/java/bin/jartoprovide/usr/bin/jar(jar)inautomode linuxidc@ubuntu:/usr/lib/jvm/java$sudoupdate-alternatives--install/usr/bin/javahjavah/usr/lib/jvm/java/bin/javah300 update-alternatives:using/usr/lib/jvm/java/bin/javahtoprovide/usr/bin/javah(javah)inautomode linuxidc@ubuntu:/usr/lib/jvm/java$sudoupdate-alternatives--install/usr/bin/javapjavap/usr/lib/jvm/java/bin/javap300 update-alternatives:using/usr/lib/jvm/java/bin/javaptoprovide/usr/bin/javap(javap)inautomode linuxidc@ubuntu:/usr/lib/jvm/java$sudoupdate-alternatives--configjava Thereisonlyonealternativeinlinkgroupjava(providing/usr/bin/java):/usr/lib/jvm/java/bin/java Nothingtoconfigure.
最后检查是否安装成功
linuxidc@ubuntu:/usr/lib/jvm/java$ java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
linuxidc@ubuntu:/usr/lib/jvm/java$
“Ubuntu下怎么安装JDK 1.8”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!
分享文章:Ubuntu下怎么安装JDK1.8
分享链接:http://scyingshan.cn/article/joghsp.html