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?
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.
Comments