M
M
Mimocodil2021-06-23 13:41:46
Java
Mimocodil, 2021-06-23 13:41:46

How to include libraries manually?

I am using Eclipse. With the help of maven, I just need to register the necessary dependency in pom.xml and that's it. But what if I have a jar file that I want to include in the project, how do I include it?

What I did (using telegrambots - maven as an example ):
1. I downloaded the latest jar.
2. In Preferences >> User Libraries I created a new library "Telegram" and added the downloaded jar of the latest version to it.
3. Added Add Library >> User Library >> Telegram to the Build Path >> Configure Build Path of the project.
4. Then I just write the initialization of the bot and eclipse does not find the necessary classes, even if I write the import manually:

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();
    }
  }
}

And with maven it worked.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2021-06-23
@Ezekiel4

Good afternoon.
And who forbids you to install the downloaded jar into the maven repository, and from there, using dependency, connect it to the project?
Here is a similar question - https://stackoverflow.com/questions/4955635/how-to... Of
course, if you have a maven project and want to include a local jar.
If you want to include local jar without maven. then:
https://www.cs.utexas.edu/~scottm/cs324e/Assignmen...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question