I am new to Java. I just wanted to make a jar file from a java file and then run the jar file. The jar is created but when I run it, I encounter this error "Could not find or load main class MyTest Caused by: java.lang.ClassNotFoundException: MyTest"
The MyTest.java file was simply something like this:
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class MyTest {
public static void main(String[] args) {
....
}
}
My Manifest.MF file is like below:
Manifest-Version: 1.0
Main-Class: MyTest
And I created the jar file using jar cmvf Manifest.MF test.jar MyTest.java
in command line.
Could anyone please help me?