我是靠谱客的博主 无私冰淇淋,最近开发中收集的这篇文章主要介绍ubuntu上安装jdk,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

1. Download the following file:
http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz (32-bit)
http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-x64.tar.gz (64-bit)

2. Decompress the .tar.gz file.

3. Move the JDK files to /usr/lib/jvm/jdk1.7.0 or elsewhere you like.

4. $sudo gvim /etc/environment  

You will see

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

Change the file as (change the installation path if needed)

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/jdk1.7.0/bin"  
CLASSPATH=.:/usr/lib/jvm/jdk1.7.0/lib  
JAVA_HOME=/usr/lib/jvm/jdk1.7.0  

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/jdk1.7.0/bin"
CLASSPATH=.:/usr/lib/jvm/jdk1.7.0/lib
JAVA_HOME=/usr/lib/jvm/jdk1.7.0

And then reload .bashrc file:

source ~/.bashrc


5. Run the following commands: 

$sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0/bin/java 300
$sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0/bin/javac 300
$sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.7.0/bin/javap 300
$sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.7.0/bin/javadoc 300

Installation has now done. Run $java -version for a test.

转载于:https://my.oschina.net/u/173183/blog/58151

最后

以上就是无私冰淇淋为你收集整理的ubuntu上安装jdk的全部内容,希望文章能够帮你解决ubuntu上安装jdk所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(65)

评论列表共有 0 条评论

立即
投稿
返回
顶部