0

I have been searching for this and nothing has helped, I'm trying to run the main class but keep getting an error. I am running this

java -classpath .\target\classes com.discordbot.Updated_Discord_Bot.Utils.Main

My main file is located in MAIN_FOLDER\target\classes\com\discordbot\Updated_Discord_Bot/Utils/Main.class

I have tried multiple commands and got nothing.

I want to run the main class located in MAIN_FOLDER\target\classes\com\discordbot\Updated_Discord_Bot/Utils/Main.class but keep getting this error, any help please?

curveball
  • 4,320
  • 15
  • 39
  • 49
TaZe Pug
  • 1
  • 1

1 Answers1

1

I tried java -cp target\classes com.discordbot.Updated_Discord_Bot.Utils.Main from Windows Command Line tool and standing on MainFolder in the CMD tool. The full path is like this

MainFolder\target\classes\com\discordbot\Updated_Discord_Bot\Utils

Where MainFolder is anywhere. All worked fine. What error do you get ? Are you sure all your .class files are generated ?

Mr. Om
  • 248
  • 2
  • 10
  • 1
    Im getting Error: Could not find or load main class and my class file are generated because I took it out of eclipse – TaZe Pug Oct 13 '18 at 17:58
  • 1
    hmm not sure how it doesn't see the main class. All I did different is is using `-cp` instead of `-classpath`. the .class file is in folder Utils and generated using `javac` command. Make sure of the folder names is same character case as the package (upper case and lower case). – Mr. Om Oct 13 '18 at 19:44
  • 1
    Nope all the caps are perfect – TaZe Pug Oct 14 '18 at 12:54
  • 1
    I tried to replicate the problem but no success so far. Feel free to share anything new to help replicating the issue and I'll update if anything new got in my way. – Mr. Om Oct 16 '18 at 08:05
  • 1
    You might want to check these questions https://stackoverflow.com/questions/16334625/eclipse-error-could-not-find-or-load-main-class https://stackoverflow.com/questions/18093928/what-does-could-not-find-or-load-main-class-mean – Anddo Oct 16 '18 at 13:56