0

I know the basics of java and am trying to code a discord bot, I have just started and am getting these errors:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    JDA cannot be resolved to a type
    JDABuilder cannot be resolved to a type
    JDABuilder cannot be resolved to a type
    AccountType cannot be resolved to a variable
package PigeonBot;

import net.dv8tion.jda.api.AccountType;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;

public class Main {
    public static JDA jda;

    public static void main (String args[]) throws loginException
    {
        jda = new JDABuilder(AccountType.BOT).setToken("");

    }

}
soz
  • 304
  • 2
  • 11
CJ Baynon
  • 1
  • 1
  • 1
    Don't try to run classes that don't compile, but instead fix the issues at compile time. – Hovercraft Full Of Eels May 15 '20 at 03:02
  • 1
    Is this duplicate link really correct, Selenium, what does that have to do with discord? The problem here is that to get the JDA instance you need to call the `build()` method of JDABuilder, like that you're assigning a `JDABuilder` to a variable of type `JDA`. Also, don't forget to call `jda.awaitReady()` before doing anything with it, or you might run into issues if your code executes before loading actually finishes. – soz May 15 '20 at 03:13
  • 1
    Oh and these classes also seem to be missing, since it's saying they cannot be resolved, have you properly imported all packages using maven/gradle, or downloaded the appropriate JARs? You can find everyting here https://github.com/DV8FromTheWorld/JDA/releases – soz May 15 '20 at 03:18
  • Do you use Eclipse? If so, this may be a more suitable duplicate: https://stackoverflow.com/questions/15794821/eclipse-error-cannot-be-resolved-to-a-type – Vince May 15 '20 at 03:32

0 Answers0