error:
Java: cannot access java.util.concurrent.CompletableFuture class file for java.util.concurrent.CompletableFuture not found
Imported the library using Maven. Here is the code to start the program:
import org.telegram.telegrambots.meta.TelegramBotsApi;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
import org.telegram.telegrambots.updatesreceivers.DefaultBotSession;
public class Main {
public static void main (String [] args) {
try {
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);
botsApi.registerBot(new telegaBot());
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
}
>Solution :
Maybe you use the old java you are trying to run. If you run through the IDE, check with which version of the java IDE you are trying to run. Requires java 8 or higher version
IDE -> ctrl+alt+shift+s -> SDK
try to up jdk version
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>19</source>
<target>19</target>
</configuration>