当我在我的虚拟机上安装JDK时,我得到以下内容:
The program 'javac' can be found in the following packages:
* default-jdk
* ecj
* gcj-4.8-jdk
* openjdk-7-jdk
* gcj-4.6-jdk
* openjdk-6-jdk
Try: apt-get install <selected package>
然后当我做apt-get时,我明白了:
root@ubuntu:/home/username# apt-get install ecj
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ecj
有关如何解决问题的建议吗?
答案 0 :(得分:2)
您可以像这样在 如果你想要Java7,那么在上一个命令E.g。 如果您在代理后面,则需要导出代理env 然后通知sudo使用它们 或在sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-set-default
sudo apt-get install oracle-java7-set-default
export http_proxy=http://username:password@host:port/
export https_proxy=https://username:password@host:port/
sudo -E add-apt-repository ppa:webupd8team/y-ppa-manager
Defaults env_keep="https_proxy"
/etc/sudoers
答案 1 :(得分:0)
尝试这样正确安装java 8,
首先更新apt-get repos
$ sudo apt-get update
将java 8 repo添加到apt-get
$ sudo add-apt-repository ppa:webupd8team/java
再次更新apt-get repo
$ sudo apt-get update
最后安装java 8
$ sudo apt-get install oracle-java8-installer