- 工信部备案号 滇ICP备05000110号-1
- 滇公安备案 滇53010302000111
- 增值电信业务经营许可证 B1.B2-20181647、滇B1.B2-20190004
- 云南互联网协会理事单位
- 安全联盟认证网站身份V标记
- 域名注册服务机构许可:滇D3-20230001
- 代理域名注册服务机构:新网数码
Ubuntu 14.04 LTS下安装JDK 1.8
先到Oracle官网的下载中心下载JDK8的tar包到本地。
下载地址:http://www.landui.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
创建应用程序主目录
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$ sudo apt-get install vim Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: vim-runtime Suggested packages: ctags vim-doc vim-scripts The following NEW packages will be installed: vim vim-runtime 0 upgraded, 2 newly installed, 0 to remove and 6 not upgraded. Need to get 5,844 kB of archives. After this operation, 28.0 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://www.landui.com/ubuntu/ trusty/main vim-runtime all 2:7.4.052-1ubuntu3 [4,888 kB] Get:2 http://www.landui.com/ubuntu/ trusty/main vim amd64 2:7.4.052-1ubuntu3 [956 kB] Fetched 5,844 kB in 18min 52s (5,159 B/s)
配置环境变量,vim ~/.bashrc文件
linuxidc@ubuntu:/usr/lib/jvm/java$ sudo vim ~/.bashrc
添加下面的内容到文件尾部
export JAVA_HOME=/usr/lib/jvm/java export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
如果你的Ubuntu上已经安装了其他版本的JDK,你可以通过update-alternatives命令来设定比如命令Java的默认命令路径。然后就是编译下让update-alternatives配置生效。
linuxidc@ubuntu:/usr/lib/jvm/java$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java/bin/java 300 update-alternatives: using /usr/lib/jvm/java/bin/java to provide /usr/bin/java (java) in auto mode linuxidc@ubuntu:/usr/lib/jvm/java$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java/bin/javac 300 update-alternatives: using /usr/lib/jvm/java/bin/javac to provide /usr/bin/javac (javac) in auto mode linuxidc@ubuntu:/usr/lib/jvm/java$ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/java/bin/jar 300 update-alternatives: using /usr/lib/jvm/java/bin/jar to provide /usr/bin/jar (jar) in auto mode linuxidc@ubuntu:/usr/lib/jvm/java$ sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/java/bin/javah 300 update-alternatives: using /usr/lib/jvm/java/bin/javah to provide /usr/bin/javah (javah) in auto mode linuxidc@ubuntu:/usr/lib/jvm/java$ sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/java/bin/javap 300 update-alternatives: using /usr/lib/jvm/java/bin/javap to provide /usr/bin/javap (javap) in auto mode linuxidc@ubuntu:/usr/lib/jvm/java$ sudo update-alternatives --config java There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java/bin/java Nothing to configure.
最后检查是否安装成功
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$
售前咨询
售后咨询
备案咨询
二维码
TOP