My Program.java is a class declared like so:
public class Program extends JFrame {
...
The program compiles and runs just fine, but when I’m creating a jar file I am recieing this error:
Exception in thread "main" java.lang.NoClassDefFoundError: Program/jar
Caused by: java.lang.ClassNotFoundException: Program.jar
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Here is how I am creating the jar file (Linux):
javac Program.java
echo Main-Class: Program >manifest.txt
jar cvfm Program.jar manifest.txt Program.class
Is this because I’m not including JFrame.class in with my jar creation? If so, is the source for JFrame available so I can include it?
Thank you and have a good one!
You need to look for the following things:
public static void main(String[] args)method.Then you should be able to run the program by calling
Cheers.