I have a class called JarTest which is in the package
Test:
package Test;
import java.io.*;
public class JarTest {
public final static void main(
String[] args )
{
System.out.println( "Hello Readers" );
}
}
I have compiled and tested it . It is working fine. Then I created an exceutable jar file using the command:
jar -cmf mainClass.txt sample.jar *.class
The contents of mainClass.txt is
Without the double quotes mentioned below)
"
Main-Class: Test.JarTest
"
It gives me the following error when I running the program from excutable jar file:
java -jar sample.jar
Exception in
thread "main" java.lang.NoClassDefFoundError: Test/JarTest
The same stuff worked when I did not specify the package "Test" for class "JarTest".
Please help.