Ubuntu18.04 安装JRE和JDK

安装vim

sudo apt-get install vim

进入/etc/apt/

cd /etc/apt

修改sources.list文件

sudo cp sources.list sources.list.bak
sudo vi sources.list

删除掉sources.list的其他内容,任意选择一种源的内容复制粘贴进去,保存,例如,选择阿里源

deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

更新apt

sudo apt-get update

安装JRE

sudo apt-get install default-jre

下载eclipse安装器

前往eclipse官网(https://www.eclipse.org/downloads/),根据系统类型下载。

解压并运行其中的eclipse-inst

tar xzvf eclipse-inst-linux64.tar.gz
cd eclipse-installer
./eclipse-inst

根据你使用的语言选择你要安装的eclipse类型:

Ubuntu18.04 安装JRE和JDK_第1张图片

选择安装路径开始安装:

建议换成home文件夹下面的路径

在Unity Dash中创建一个快捷菜单项:

vim .local/share/applications/eclipse.desktop

写入如下内容,注意把/home/XXXXX/eclipse/…替换成你的eclipse安装路径:

[Desktop Entry]
Name=Eclipse
Type=Application
Exec=/home/XXX/eclipse/cpp-oxygen/eclipse/eclipse
Terminal=false
Icon=/home/XXX/eclipse/cpp-oxygen/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;
Name[en]=Eclipse

如果出现The Eclipse executable launcher was unable to locate its companion shared library

sudo chmod 775 -R /root/

安装完成!

你可能感兴趣的:(Java)