简体   繁体   English

Linux Mint无法安装JDK

[英]Linux Mint Can't install JDK

I have some stack problems when installing JDK jdk_1.8.005-1_i386.deb on Linux Mint 16 Cinamons petra. 在Linux Mint 16 Cinamons petra上安装JDK jdk_1.8.005-1_i386.deb时遇到一些堆栈问题。 I tried with alien -i jdk-8u5-linux-i586.rpm and direct install with jdk_1.8.005-1_i386.deb I still get this error on my console: 我尝试使用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

How can I solve this? 我该如何解决?

I basically never use the deb file for that matter. 我基本上从不使用deb文件。 From experience it is easier to use the archieve version(tgz). 根据经验,更容易使用存档版本(tgz)。

Download and extract the tgz under /usr/java, then: 下载并解压缩/ 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

Create symbolic links to java executables 创建指向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

define a global JAVA_HOME 定义一个全局的JAVA_HOME

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

finally let mint know which java to use 最终让mint知道要使用哪个java

 sudo update-alternatives --config java

and select the right version from a list 然后从列表中选择合适的版本

The problem is in the error message: 问题出在错误消息中:

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

Remove your current JDK before installing the new one. 在安装新的JDK之前,请先删除它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM