JDA Path in Linux

  • Java

    JDA Path in Linux

    Hey Leute ich bin es mal wieder! :)
    Komme ich gleich zum Punkt. Ich verwende die ini4j Libary mit JDA maven, alles funktioniert auch super, allerdings sobald ich den (Ich Programmiere übrigens einen Discord Bot) Discord Bot als .jar auf meinem Ubuntu Server starte bekomme ich immer unerklärliche Fehler in der Zeile des Pfades der .ini Datei (Auf Windows (angepasster Path) funktioniert alles wunderbar.). Hoffe ihr könnt mir helfen.

    Java-Quellcode

    1. /*
    2. *
    3. *
    4. *
    5. */
    6. package commands;
    7. import core.permsCore;
    8. import net.dv8tion.jda.core.EmbedBuilder;
    9. import net.dv8tion.jda.core.entities.User;
    10. import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
    11. import org.ini4j.Ini;
    12. import java.awt.*;
    13. import java.io.File;
    14. public class cmdCheck implements Command {
    15. String messagef;
    16. User selected_user;
    17. Integer warns;
    18. EmbedBuilder message = new EmbedBuilder().setColor(Color.CYAN).setTitle("User");
    19. @Override
    20. public boolean called(String[] args, MessageReceivedEvent event) {
    21. return false;
    22. }
    23. @Override
    24. public void action(String[] args, MessageReceivedEvent event) {
    25. if (permsCore.Supporter(event))
    26. return;
    27. if(event.getMessage().getMentionedUsers().size() > 0 && event.getMessage().getMentionedUsers().size() < 2) {
    28. selected_user = event.getMessage().getMentionedUsers().size() > 0 ? event.getMessage().getMentionedUsers().get(0) : null;
    29. try {
    30. System.out.println("write");
    31. Ini ini = new Ini(new File("/home/akira/bot/warns.ini"));
    32. System.out.println("write2");
    33. try {
    34. if(ini.get(selected_user.getName().toString(), "warns", Integer.class) <= 0) {
    35. warns = 0;
    36. System.out.println("write2,3");
    37. } else {
    38. System.out.println("write2,3,5");
    39. warns = ini.get(selected_user.getName().toString(), "warns", Integer.class);
    40. }
    41. } catch (Exception e){
    42. warns = 0;
    43. }
    44. if(warns == 0){
    45. event.getTextChannel().sendMessage(
    46. new EmbedBuilder().setColor(Color.RED).setDescription(":x: Dieser User wurde noch wie verwarnt!. :)").build()
    47. ).queue();
    48. } else if (warns == 1){
    49. event.getTextChannel().sendMessage(
    50. message.setTitle("Spieler: " + selected_user.getName().toString()).setColor(Color.RED).setDescription("Der Spieler " + selected_user.getName().toString() + " wurde " + warns +" mal verwarnt. :) \n" +
    51. "\n" +
    52. ":spider_web: Verwarnungen\n" +
    53. "\n" +
    54. "" + ini.get(selected_user.getName().toString(), "1", String.class) + " | Verwarnt von: " + ini.get(selected_user.getName().toString(), "1_gewarnt_von", String.class) + "\n"+
    55. "\n").build()
    56. ).queue();
    57. } else if (warns == 2){
    58. event.getTextChannel().sendMessage(
    59. message.setTitle("Spieler: " + selected_user.getName().toString()).setColor(Color.RED).setDescription("Der Spieler " + selected_user.getName().toString() + " wurde " + warns +" mal verwarnt. :) \n" +
    60. "\n" +
    61. ":spider_web: Verwarnungen\n" +
    62. "\n" +
    63. "" + ini.get(selected_user.getName().toString(), "1", String.class) + " | Verwarnt von: " + ini.get(selected_user.getName().toString(), "1_gewarnt_von", String.class) + "\n"+
    64. "\n" +
    65. "" + ini.get(selected_user.getName().toString(), "2", String.class) + " | Verwarnt von: " + ini.get(selected_user.getName().toString(), "1_gewarnt_von", String.class) + "\n"+
    66. "\n").build()
    67. ).queue();
    68. } else if (warns == 3){
    69. event.getTextChannel().sendMessage(
    70. message.setTitle("Spieler: " + selected_user.getName().toString()).setColor(Color.RED).setDescription("Der Spieler " + selected_user.getName().toString() + " wurde " + warns +" mal verwarnt. :) \n" +
    71. "\n" +
    72. ":spider_web: Verwarnungen\n" +
    73. "\n" +
    74. "" + ini.get(selected_user.getName().toString(), "1", String.class) + " | Verwarnt von: " + ini.get(selected_user.getName().toString(), "1_gewarnt_von", String.class) + "\n"+
    75. "\n" +
    76. "" + ini.get(selected_user.getName().toString(), "2", String.class) + " | Verwarnt von: " + ini.get(selected_user.getName().toString(), "1_gewarnt_von", String.class) + "\n"+
    77. "\n" +
    78. "" + ini.get(selected_user.getName().toString(), "3", String.class) + " | Verwarnt von: " + ini.get(selected_user.getName().toString(), "1_gewarnt_von", String.class) + "\n"+
    79. "\n").build()
    80. ).queue();
    81. }
    82. } catch (Exception e) {
    83. }
    84. }


    Fehler:

    Quellcode

    1. [16:13:20] [ERROR] [net.dv8tion.jda.core.JDA]: One of the EventListeners had an uncaught exception
    2. [16:13:20] [ERROR] [net.dv8tion.jda.core.JDA]: Encountered an Exception:
    3. java.lang.NoClassDefFoundError: org/ini4j/Ini
    4. at commands.cmdCheck.action(cmdCheck.java:48)
    5. at core.commandHandler.handleCommand(commandHandler.java:18)
    6. at listeners.commandListener.onMessageReceived(commandListener.java:13)
    7. at net.dv8tion.jda.core.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:404)
    8. at net.dv8tion.jda.core.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:84)
    9. at net.dv8tion.jda.core.handle.MessageCreateHandler.handleDefaultMessage(MessageCreateHandler.java:128)
    10. at net.dv8tion.jda.core.handle.MessageCreateHandler.handleInternally(MessageCreateHandler.java:49)
    11. at net.dv8tion.jda.core.handle.SocketHandler.handle(SocketHandler.java:37)
    12. at net.dv8tion.jda.core.requests.WebSocketClient.handleEvent(WebSocketClient.java:978)
    13. at net.dv8tion.jda.core.requests.WebSocketClient.onTextMessage(WebSocketClient.java:666)
    14. at com.neovisionaries.ws.client.ListenerManager.callOnTextMessage(ListenerManager.java:352)
    15. at com.neovisionaries.ws.client.ReadingThread.callOnTextMessage(ReadingThread.java:260)
    16. at com.neovisionaries.ws.client.ReadingThread.callOnTextMessage(ReadingThread.java:238)
    17. at com.neovisionaries.ws.client.ReadingThread.handleTextFrame(ReadingThread.java:963)
    18. at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:746)
    19. at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
    20. at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
    21. at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)
    22. Caused by: java.lang.ClassNotFoundException: org.ini4j.Ini
    23. at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    24. at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    25. at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    26. at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    27. ... 18 more


    Lg. Mo

    Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von „MaLeTut“ ()