美文网首页
腾讯云服务器安装Java环境问题:

腾讯云服务器安装Java环境问题:

作者: 米饭超人 | 来源:发表于2019-07-30 08:45 被阅读0次

系统:Ubuntu Server 18.04.1 LTS 64位
安装:Maven、Java环境时抛错:
E: Unable to locate package upgrade

解决办法:
对于Ubuntu操作系统,很多同学在使用apt-get install的时候 会发现很多源都找不到,原因是系统初始的资源库找不到指定的包,解决方法:

1、执行下面的命令,编辑系统资源库列表:

         vi /etc/apt/sources.list

2、修改为以下内容(原来的内容可以注释一下):

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

3、执行下面的命令,更新系统资源库列表:

         sudo apt-get update

         sudo apt-get upgrade

4、重新执行sudo apt-get install xxxx 试试

安装openjdk

1、更新软件包列表:
sudo apt-get update

2、安装openjdk-8-jdk:
sudo apt-get install openjdk-8-jdk

3、查看java版本,看看是否安装成功:
java -version

image

相关文章

网友评论

      本文标题:腾讯云服务器安装Java环境问题:

      本文链接:https://www.haomeiwen.com/subject/iiybrctx.html