{
BufferedReader reader2 = new BufferedReader(new FileReader("Ranking.txt"));
String line2;
String text = "";
while ((line2 = reader2.readLine()) != null) {
text = text + "\n" + line2;
}
try {
if (text.length() > 150) {
//here trying uploading the backup.
File backup = new File("Ranking.txt");
Calendar cal2 = Calendar.getInstance(TimeZone.getTimeZone("MEZ"));
SimpleDateFormat sdf2 = new SimpleDateFormat("dd_MM__HH_mm");
String time2 = sdf2.format(cal2.getTime());
Rollen.g.getTextChannelById("575303845203279872").sendFile(backup,"Backup_"+time2+".txt").queue();
/*here it throws the exception.*/
} else {
Message m = Rollen.g.getTextChannelById("575303845203279872").retrieveMessageById(Rollen.g.getTextChannelById("575303845203279872").getLatestMessageId()).complete();
m.getAttachments().get(0).downloadToFile("Ranking.txt");
}
} catch (Exception x){
Message m = Rollen.g.getTextChannelById("575303845203279872").retrieveMessageById(Rollen.g.getTextChannelById("575303845203279872").getLatestMessageId()).complete();
m.getAttachments().get(0).downloadToFile("Ranking.txt");
}
reader2.close();
}
如果我在IntelliJ上运行代码,它可以完美运行,但是如果我在控制台或Raspbrery pi上运行它,我会得到一个 “ java.lang.ClassNotFoundException:net.dv8tion.jda.api.utils.AttachmentOption”。