Error: Could not find or load main class while class is included in the jar file

CrazySynthax

I want to mention that I already read these threads:

Error: Could not find or load main class

What does "Could not find or load main class" mean?

and I found no solution to my problem. I have a jar file named BatchPricing.jar that includes a class named com.tools.batchpricing.Main. I know this for sure because I open the jar file with 7-zip and I see this class there.

When I run it on windows I activate the command:

java -Xmx300M -classpath BatchPricing.jar com.tools.batchpricing.Main %*

I run if from the folder that contains BatchPricing.jar. However, I still get the error:

Error: Could not find or load main class com.tools.batchpricing.Main

Do you know how I can resolve it?

lexicore

The first thing you should do in this situation is to run:

jar -tf my-package.jar

This will list files in the JAR, somethink like:

org/apache/commons/lang3/time/FastDatePrinter$Rule.class
org/apache/commons/lang3/time/FastDatePrinter$StringLiteral.class
org/apache/commons/lang3/time/FastDatePrinter$TextField.class
org/apache/commons/lang3/time/FastDatePrinter$TimeZoneDisplayKey.class
org/apache/commons/lang3/time/FastDatePrinter$TimeZoneNameRule.class
org/apache/commons/lang3/time/FastDatePrinter$TimeZoneNumberRule.class
org/apache/commons/lang3/time/FastDatePrinter$TwelveHourField.class
org/apache/commons/lang3/time/FastDatePrinter$TwentyFourHourField.class
org/apache/commons/lang3/time/FastDatePrinter$TwoDigitMonthField.class
org/apache/commons/lang3/time/FastDatePrinter$TwoDigitNumberField.class

Make sure you see com/tools/batchpricing/Main.class in this list. If your class is not in this list or is included as com/tools/batchpricing/Main.java instead of .class, probably something went wrong with compilation/building of the JAR.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

IntelliJ artifact JAR file: Could not find or load main class

From Java

Error: Could not find or load main class - .jar file execution

From Java

Heroku "could not find or load main class" error

From Java

Scala jar: Error: Could not find or load main class

From Java

Error: Could not find or load main class CountRows?

From Java

Error: Could not find or load main class

From Java

.jar error - could not find or load main class

From Java

Error: Could not find or load main class version

From Java

Eclipse "Error: Could not find or load main class"

From Java

Error: Could not find or load main class HelloWorld

From Java

Error: Could not find or load main class - Spring Boot Application jar

From Dev

Cannot run jar file: Could not find or load main class Hello

From Dev

Executing batch file error: "Could not find or load main class"

From Dev

Unable to run jar file. (Error: Could not find or load main class co.pissarra.Mainkt)

From Dev

Error: Could not find or load main class while executing jar file

From Dev

Java - Error : Could not find or load main class

From Dev

After creating JAR file, command line returns 'Error: Could not find or load main class ExampleProgram`?

From Dev

Error: Could not find or load main class while parsing an XML file

From Dev

Error: Could not find or load main class Main

From Dev

Error : Could not find or load main class Protection

From Dev

error: could not load or find main class xyz

From Dev

Error Could not find or load main class

From Dev

Error: Could not find or load main class?

From Dev

Error: Could not find or load main class ClassDemo

From Dev

Error running .jar on Ubuntu: Could not find ot load main class

From Dev

Could not find or load main class jar intelij

From Dev

Could not find or load main class with gradle generated jar file

From Dev

Getting Error: Could not find or load main class while opening executable Jar file

From Dev

"Could not find or load main class" in Maven jar

Related Related

  1. 1

    IntelliJ artifact JAR file: Could not find or load main class

  2. 2

    Error: Could not find or load main class - .jar file execution

  3. 3

    Heroku "could not find or load main class" error

  4. 4

    Scala jar: Error: Could not find or load main class

  5. 5

    Error: Could not find or load main class CountRows?

  6. 6

    Error: Could not find or load main class

  7. 7

    .jar error - could not find or load main class

  8. 8

    Error: Could not find or load main class version

  9. 9

    Eclipse "Error: Could not find or load main class"

  10. 10

    Error: Could not find or load main class HelloWorld

  11. 11

    Error: Could not find or load main class - Spring Boot Application jar

  12. 12

    Cannot run jar file: Could not find or load main class Hello

  13. 13

    Executing batch file error: "Could not find or load main class"

  14. 14

    Unable to run jar file. (Error: Could not find or load main class co.pissarra.Mainkt)

  15. 15

    Error: Could not find or load main class while executing jar file

  16. 16

    Java - Error : Could not find or load main class

  17. 17

    After creating JAR file, command line returns 'Error: Could not find or load main class ExampleProgram`?

  18. 18

    Error: Could not find or load main class while parsing an XML file

  19. 19

    Error: Could not find or load main class Main

  20. 20

    Error : Could not find or load main class Protection

  21. 21

    error: could not load or find main class xyz

  22. 22

    Error Could not find or load main class

  23. 23

    Error: Could not find or load main class?

  24. 24

    Error: Could not find or load main class ClassDemo

  25. 25

    Error running .jar on Ubuntu: Could not find ot load main class

  26. 26

    Could not find or load main class jar intelij

  27. 27

    Could not find or load main class with gradle generated jar file

  28. 28

    Getting Error: Could not find or load main class while opening executable Jar file

  29. 29

    "Could not find or load main class" in Maven jar

HotTag

Archive