The command given below will help you to run the JAR file.
java -classpath Predit.jar your.package.name.MainClass
We should specify a main class in the JAR file Manifest.
For Example: If you have a Demo class.
public class Demo
{
public static void main(String[] args)
{
System.out.println("Hello world. Happy Learning");
}
}
manifest.mf will be:
Manifest-version: 1.0
Main-Class: Demo
Now, you can run the code.
javac Demo.java
jar cfm test.jar manifest.mf Demo.class
java -jar demo.jar