سؤال

I'm having trouble running a java Jar file. I'm getting the error "Could not find the main class: com.body.Mouth. Program will exit."

Valid (No error):
running Mouth class from eclipse. main function is in Mouth.


Invalid (could not find main class error):

    java -jar Eat.jar
    java -jar Eat.jar com.body.Mouth

thanks,

Hank

هل كانت مفيدة؟

المحلول

Try this:

java -classpath PATH_TO_EAT.jar com.body.Mouth

نصائح أخرى

The command

java -jar Eat.jar

Will attempt to execute the Main Class found in the META-INF/MANIFEST.MF that would look something like this:

Manifest-Version: 1.0
Created-By: 1.7.0_06 (Oracle Corporation)
Main-Class: com.body.Mouth

You can learn more about creating an executing JAR here

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top