Unsure why I am getting this error, I feel that I am missing something very simple. This is an issue I am facing trying to follow this post on creating a JAR executable from the command line. Here are my simple test files:
JarExample.java:
public class JarExample {
public static void main(String[] args) {
}
}
MANIFEST.MF:
Manifest-Version: 1.0
Main-Class: JarExample
I run the follow commands to construct the JAR:
javac JarExample.java
jar cfm JarExample.jar MANIFEST.MF *.class
Yet when I run java -jar JarExample.jar
, I get the following error:
no main manifest attribute, in JarExample.jar
Peaking inside the JAR, the correct class file is present, but the following autogenerated manifest, META-INF/MANIFEST.MF
, is present:
Manifest-Version: 1.0
Created-By: 1.8.0_162 (Oracle Corporation)
So where is my usage of the jar
command incorrect? Why does it not recognize my supplied manifest file?
Thanks!