本篇內(nèi)容介紹了“Ubuntu下怎么安裝JDK 1.8”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠?qū)W有所成!
在隴西等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強發(fā)展的系統(tǒng)性、市場前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供網(wǎng)站設(shè)計、成都做網(wǎng)站 網(wǎng)站設(shè)計制作按需求定制制作,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),成都全網(wǎng)營銷,外貿(mào)營銷網(wǎng)站建設(shè),隴西網(wǎng)站建設(shè)費用合理。
Ubuntu14.04 LTS下安裝JDK 1.8
先到Oracle官網(wǎng)的下載中心下載JDK8的tar包到本地。
創(chuàng)建應(yīng)用程序主目錄
linuxidc@ubuntu:/usr/lib$ sudo mkdir jvm
解壓下載的tar包到應(yīng)用程序主目錄下
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)
配置環(huán)境變量,vim ~/.bashrc文件
linuxidc@ubuntu:/usr/lib/jvm/java$ sudo vim ~/.bashrc
添加下面的內(nèi)容到文件尾部
exportJAVA_HOME=/usr/lib/jvm/java exportJRE_HOME=${JAVA_HOME}/jre exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib exportPATH=${JAVA_HOME}/bin:$PATH
如果你的Ubuntu上已經(jīng)安裝了其他版本的JDK,你可以通過update-alternatives命令來設(shè)定比如命令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”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!