Pregunta

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

¿Fue útil?

Solución

Try this:

java -classpath PATH_TO_EAT.jar com.body.Mouth

Otros consejos

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top