Closed itai590 closed 3 years ago
user@laptop:~ $ java -jar bot.jar Exception in thread "main" java.lang.NoSuchMethodError: 'void org.telegram.telegrambots.meta.TelegramBotsApi.<init>(java.lang.Class)' at mybot.MainClass.main(MainClass.java:14)
import org.telegram.telegrambots.meta.TelegramBotsApi; import org.telegram.telegrambots.meta.exceptions.TelegramApiException; import org.telegram.telegrambots.updatesreceivers.DefaultBotSession; public class MainClass { public static void main(String[] args) { try { TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class); //line 14 telegramBotsApi.registerBot(new mybot()); } catch (TelegramApiException e) { e.printStackTrace(); } }
The jar you've build is missing its dependencies. You either have to build a fat-jar or tell the Java runtime where the dependencies are
I managed to fix it Thank you
Great then please close the issue @itai590