Mispelled classname in manifest.txt file caused this error
Im trying to run a java file outside of my IDE by exporting the .jar file to my documents folder and trying to display the text 'hello world'in the file on the terminal line. I attempted to create a Manifest.txt file with this in it,
Main-Class: lightning.java.hello.MyFirstClass
I then used this script to create a file MyJar.jar and got this back,
lightning@rigel5:~$ jar cfm MyJar.jar Manifest.txt lightning.java.hello/*.class java.io.FileNotFoundException: Manifest.txt (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(FileInputStream.java:138) at java.io.FileInputStream.(FileInputStream.java:97) at sun.tools.jar.Main.run(Main.java:171) at sun.tools.jar.Main.main(Main.java:1177)
You can run java package using this command on your terminal:
If you don't have Java Runtime Edition (JRE) you'll need to install
default-jre
package.This shows that you clearly have done a mistake in the
META-INF/MANIFEST.MF
See this Tutorial for more informations.
First you need a main-method in your class file - public static void main(String args[]){ ... } - probably done...
In the jar-file you need a manifest.txt file - inside the class with the main method has to be noted like this -> Main-Class: MyPackage.MyClass
To create one you can use the commandline tool jar ...
If you don't have an manifest-file in your jar, you can just type: