M
M
Mimocodil2021-06-18 11:35:45
Eclipse
Mimocodil, 2021-06-18 11:35:45

How to include the library manually?

I want to connect the telegrambots library to a java project.

I used to do this with maven , but I want to try connecting without it, manually.

What I did:
1. In Preferences >> User Libraries I created a new "Telegram" library and added the downloaded jar of the latest version to it.
2. Added Add Library >> User Library >> Telegram to the Build Path >> Configure Build Path of the project.

Further, when I try to write initialization, I catch errors saying that the required classes were not found. In a maven project this worked.

Bot initialization
import org.telegram.telegrambots.bots.TelegramLongPollingBot;
import org.telegram.telegrambots.meta.TelegramBotsApi;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
import org.telegram.telegrambots.updatesreceivers.DefaultBotSession;

public class Bot extends TelegramLongPollingBot {
  public static void main(String[] args) {
    try {
      new TelegramBotsApi(DefaultBotSession.class).registerBot(new Bot());
    } catch (TelegramApiException e) {
      e.printStackTrace();
    }
  }
}


How can you do it anyway?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question