Troskyvs :
I've got these following steps:
(1) I'm under my Linux home directory of /home/a
(2) A simple java file, cat m.java
package my;
public class m{
public static void main(String[] args){
}
}
(3) javac m.java
(4) mkdir my && cp m.class my/
(5) $ cat manifest.mf
Manifest-Version: 1.0
Main-Class: my/m
Class-Path: /home/a
(6) jar cfm m.jar manifest.mf m.class
(7) java -jar m.jar
Error: Could not find or load main class m.class
How to make it work?
user7294900 :
Main-Class should be with package with dot separated and not /
Main-Class: my.m
Main-Class: MyPackage.MyClass
Remove Class-Path line if you don't need more jars
Adding Classes to the JAR File's Classpath You may need to reference classes in other JAR files from within a JAR file.