Basically I was learning the compilation process of an executable jar file. So, for that purpose, inside a directory src\com\mftest
, I have a file named Test.java
, with the following contents.
package com.mftest;
public class Test
{
public static void main(String args[])
{
System.out.println("Hello from Test!");
}
}
Now, from the main folder (one containing the src
folder), where I also have the folder bin
, I type javac -d bin src\com\mftest\Test.java
. This creates the file bin\com\mftest\Test.class
.
Then, from within the folder bin\com\mftest
, I create a file Manifest.txt
with the following contents. Note that here there are two lines, with the 2nd line being blank.
Main-Class: com.mftest.Test
From within the bin\com\mftest
folder, I now type jar cmvf Manifest.txt Test.jar *.class
to create the file bin\com\mftest\Test.jar
. I expected that file to be executable, but when I try to run it by typing java -jar Test.jar
, I get the following error.
Error: Could not find or load main class com.mftest.Test
Caused by: java.lang.ClassNotFoundException: com.mftest.Test
Any idea, what mistake am I doing here?