I hava made a runnable jar file out of six classes:
Main: Contains the main method, and specified in the manifest (I included a new line)
Main$1 and Main$2: 2 anonymous inner classes that are in the main class. (Main$2 is in the main method, but I don't think that really matters.)
Form
Form$1: An anonymous inner class in Form
WrapLayout
I specify these inner classes when making the jar file, but when I look inside it (I am on mac) the inner classes are not in the jar! So when I run it, I get this:
Exception in thread "main" java.lang.NoClassDefFoundError: Main$2
at Main.main(Main.java:64)
Caused by: java.lang.ClassNotFoundException: Main$2
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 1 more
I can't figure out what's wrong. Can somebody please help?
EDIT: I figured it out! Turns out, you need an escape character (\) in front of the dollar signs for the command to recognize them.