Linux Mint无法安装JDK

时间:2014-05-10 11:25:52

标签: java linux

我在Linux Mint 16 Cinamons petra上安装JDK jdk_1.8.005-1_i386.deb时遇到了一些堆栈问题。我尝试使用alien -i jdk-8u5-linux-i586.rpm并直接安装 jdk_1.8.005-1_i386.deb我的控制台上仍然出现此错误:

(Reading database ... 152427 files and directories currently installed.)
Unpacking jdk (from .../jdk_1.8.005-1_i386.deb) ...
dpkg: error processing /home/dejjan/Downloads/jdk_1.8.005-1_i386.deb (--install):
 trying to overwrite '/etc/.java/.systemPrefs/.system.lock', which is also in package jre 1.7.055-1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /home/dejjan/Downloads/jdk_1.8.005-1_i386.deb

我该如何解决这个问题?

2 个答案:

答案 0 :(得分:2)

我基本上从不使用deb文件。根据经验,使用archieve版本(tgz)更容易。

在/ usr / java下下载并解压缩tgz,然后:

sudo ln -sf /usr/java/jdk1.8-version/ /usr/java/default #so that you can change easily the java version in the future
sudo rm /usr/bin/java /usr/bin/javac /usr/bin/jar

创建指向java可执行文件的符号链接

sudo ln -sf /usr/java/default/bin/java /usr/bin/java
sudo ln -sf /usr/java/default/bin/javac /usr/bin/javac
sudo ln -sf /usr/java/default/bin/jar /usr/bin/jar

定义全局JAVA_HOME

sudo bash -l -c "echo export JAVA_HOME=/usr/java/default >> /etc/profile"

最后让薄荷知道使用哪个java

 sudo update-alternatives --config java

并从列表中选择正确的版本

答案 1 :(得分:0)

问题在于错误消息:

 trying to overwrite '/etc/.java/.systemPrefs/.system.lock', which is also in package jre 1.7.055-1 

在安装新JDK之前删除当前的JDK。