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发现就有提示了,说明配置都已经帮我们做好了。

    

相关文章
|
Java Linux
CentOS 7.5 JDK安装
本篇内容记录了相关 JDK安装的操作。
117 0
CentOS 7.5 JDK安装
|
弹性计算 Java Linux
阿里云 Centos7.5安装JDK1.8与环境变量配置全教程
阿里云 Centos7.5安装JDK1.8与环境变量配置全教程
1921 0
阿里云 Centos7.5安装JDK1.8与环境变量配置全教程
|
Ubuntu Java Linux
Ubuntu环境变量配置
前提: 之前一直想用ubuntu,但是现在大部分编程都是在windows上,所以很少用。但是现在需要编译ffmpeg, 奈何windows上遇到了各种bug,不好处理,索性直接给自己的老人机上安装了ubuntu系统。
1197 0
|
Java 关系型数据库 Oracle
|
Ubuntu JavaScript Java
ubuntu 下安装java环境
ubuntu 16.04 安装常用软件 1初始化电脑 1.1 512G硬盘分区 1.
2771 0