R
rob hadow
I have been experimenting with making my own JAR files.
Some of which work and some don't. After hours of altering the application I
haven't been able work out why they sometimes work and sometimes don't.
When the JAR file won't run I get an Exception in thread "Main"
java.lang.NoClassDefFoundError ,but at other times
I get an Exception in thread "main" java.lang.ClassFormatError: MyClass (Bad
magic number).
I create and run the jar file using the following steps:
1/ I create a manifest file, saved as"info"
Manifest-Version: 1.0
Created-By: 1.4.1_05
Main-Class: MyClass
2/ Create a java file "MyClass.java"
Public MyClass {
public static void main(String args[])
{
System.out.println("MyClass running");
}
}
3/ Create a class file "MyClass.class"
javac Myclass.java
4/ Test the application... java MyClass
5/ Create a Jar file .........jar cmf info MyJar.jar MyClass.class
6/ Run the jar file...........java -jar MyJar.jar
I don't understand why it compiles and runs ok, but i get exceptions thrown
when i attempt to run the jar.
I would be very grateful for any help!
?????????
Rob Hadow
Some of which work and some don't. After hours of altering the application I
haven't been able work out why they sometimes work and sometimes don't.
When the JAR file won't run I get an Exception in thread "Main"
java.lang.NoClassDefFoundError ,but at other times
I get an Exception in thread "main" java.lang.ClassFormatError: MyClass (Bad
magic number).
I create and run the jar file using the following steps:
1/ I create a manifest file, saved as"info"
Manifest-Version: 1.0
Created-By: 1.4.1_05
Main-Class: MyClass
2/ Create a java file "MyClass.java"
Public MyClass {
public static void main(String args[])
{
System.out.println("MyClass running");
}
}
3/ Create a class file "MyClass.class"
javac Myclass.java
4/ Test the application... java MyClass
5/ Create a Jar file .........jar cmf info MyJar.jar MyClass.class
6/ Run the jar file...........java -jar MyJar.jar
I don't understand why it compiles and runs ok, but i get exceptions thrown
when i attempt to run the jar.
I would be very grateful for any help!
?????????
Rob Hadow