我尝试安装cassandra appache。我正在按照debianpackaging wiki中的步骤进行操作。我已将这两行添加到我的sources.list:
ola@station:~$ cat /etc/apt/sources.list | grep "apache"
deb http://www.apache.org/dist/cassandra/debian 30x main
deb-src http://www.apache.org/dist/cassandra/debian 30x main
ola@station:~$
我的java版也很好看:
olas@station:~$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
olas@station:~$
但是,当我尝试安装它时,我收到以下错误消息:
olas@station:~$ sudo apt-get install cassandra
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
cassandra : Depends: openjdk-8-jre-headless but it is not installable or
java8-runtime but it is not installable
Recommends: ntp but it is not going to be installed or
time-daemon
E: Unable to correct problems, you have held broken packages.
我该如何解决这个问题?
答案 0 :(得分:8)
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install cassandra
答案 1 :(得分:1)
您需要从backports安装openjdk-8-jre-headless
,运行:
import java.io.*;
import java.util.*;
public class FileSplit
{
public static void main(String[] args) {
try {
FileReader reader = new FileReader("example.txt");
BufferedReader bufferedReader = new BufferedReader(reader);
FileWriter writer = new FileWriter("output.txt");
BufferedWriter bufferedWriter = new BufferedWriter(writer);
FileWriter writer_ = new FileWriter("output_.txt");
BufferedWriter bufferedWriter_ = new BufferedWriter(writer_);
String line;
while ((line = bufferedReader.readLine()) != null) {
String[] str = line.split(" ");
bufferedWriter.write(str[0]);
bufferedWriter.flush();
bufferedWriter.newLine();
bufferedWriter_.write(str[1]);
bufferedWriter_.flush();
bufferedWriter_.newLine();
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
添加以下行:
apt edit-sources
更新:
deb http://httpredir.debian.org/debian jessie-backports main
安装所需的包:
apt-get update && apt-get upgrade
apt-get -f install
安装apt-get -t jessie-backports install openjdk-8-jre-headless
apt-get install ntp
cassandra