Ubuntu 14.04 jdk安装与配置

简介:

(1)jdk安装

    需要在ubuntu下使用Pycharm,但是Pycharm是用Java写的,所以必须安装jdk。安装的方法很多,上官网找了适合Ubuntu的,给出下面的文档:

============================================

Installation of the 64-bit JDK on Linux Platforms

This procedure installs the Java Development Kit (JDK) for 64-bit Linux, using an archive binary file (.tar.gz).

These instructions use the following file:

jdk-8uversion-linux-x64.tar.gz
  1. Download the file.

    Before the file can be downloaded, you must accept the license agreement. The archive binary can be installed by anyone (not only root users), in any location that you can write to. However, only the root user can install the JDK into the system location.

  2. Change directory to the location where you would like the JDK to be installed, then move the .tar.gz archive binary to the current directory.

  3. Unpack the tarball and install the JDK.

    % tar zxvf jdk-8uversion-linux-x64.tar.gz

    The Java Development Kit files are installed in a directory called jdk1.8.0_version in the current directory.

  4. Delete the .tar.gz file if you want to save disk space.

============================================

    显然有时候你会发现自己看官方的英文文档要比上网去找教程好,网上的教程虽多,但有时候也杂乱,所以这时候还不如找官方的文档看。链接可以看这里:http://docs.oracle.com/javase/8/docs/technotes/guides/install/linux_jdk.html

    完了之后,选择把jdk解压在/usr/lib/java目录中,安装即完成。


(2)配置环境变量

    执行下面的命令:

1
echo  "PATH=$PATH:/usr/lib/java/jdk1.8.0_65/bin"  >> ~/.bashrc

    使配置生效:

1
source  ~. /bashrc

    输入java:

1
2
3
4
5
6
xpleaf@leaf:~$ java
用法: java [-options] class [args...]
            (执行类)
    或  java [-options] -jar jarfile [args...]
            (执行 jar 文件)
......................

    

    比较简单。


(3)更好的安装与配置方法

    当然前面的都要自己去动手,如果你觉得还是太麻烦了,那就采用在线的方式吧。这样做还有一个好处,那就是不用你自己手动配置。

    1.首先更新软件源

    sudo apt-get update

    如果更新软件源的时候总是出现问题,你可以考虑更改软件源,只需要把/etc/source.list中的内容修改就可以了,至于哪个更新源比较好,看你所在的网络环境。自己可以百度去找一些,建议用国内的。


    2.安装jdk

    sudo apt-get install openjdk-8-jre

    如果提示说没有这个软件,那就说明是软件源的问题,把软件源改掉吧。

    

    3.输入java

    输入java发现就有提示了,说明配置都已经帮我们做好了。

    




本文转自 xpleaf 51CTO博客,原文链接:http://blog.51cto.com/xpleaf/1736303,如需转载请自行联系原作者

相关文章
|
21天前
|
Ubuntu NoSQL 关系型数据库
Ubuntu系统下安装常用软件
Ubuntu系统下安装常用软件
42 0
Ubuntu系统下安装常用软件
|
1月前
|
Ubuntu Linux C语言
Ubuntu下安装vscode,并解决终端打不开vscode的问题
Ubuntu下安装vscode,并解决终端打不开vscode的问题
134 0
|
1月前
|
Ubuntu Docker 容器
如何在Ubuntu上安装Docker?
【2月更文挑战第10天】
240 0
|
23天前
|
Ubuntu 关系型数据库 MySQL
Ubuntu 中apt 安装MySQL数据库
Ubuntu 中apt 安装MySQL数据库
66 0
|
2天前
|
Ubuntu 数据安全/隐私保护
在UBUNTU虚拟机上安装R软件包
在UBUNTU虚拟机上安装R软件包
|
2天前
|
存储 编解码 Ubuntu
0-零基础安装ubuntu(超详细安装步骤)
0-零基础安装ubuntu(超详细安装步骤)
|
3天前
|
Ubuntu Linux 定位技术
手把手教你优雅的安装虚拟机 Ubuntu —— 图文并茂
手把手教你优雅的安装虚拟机 Ubuntu —— 图文并茂
|
15天前
|
Ubuntu 开发工具
Ubuntu vim配置支持鼠标
Ubuntu vim配置支持鼠标
12 0
|
17天前
|
Ubuntu Linux 虚拟化
【Linux】ubuntu安装samba服务器
【Linux】ubuntu安装samba服务器
|
22天前
|
Java Linux
linux安装jdk环境
linux安装jdk环境
27 0