I created a runnable jar file from six classes from hava:
Main: Contains the main method and is specified in the manifest (I included a new line)
Basic $ 1 and basic $ 2: 2 are anonymous inner classes that are in the main class. (Basic $ 2 in the main method, but I donβt think it really matters.)
The form
Form $ 1: anonymous inner class in form
Wraplayout
I define these inner classes when creating the jar file, but when I look into it (I'm on a mac), inner classes are not in the bank! So when I run it, I get the following:
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 understand what happened. Can anybody help?
EDIT: I get it! Turns out you need the escape character (\) in front of the dollar signs for the team to recognize them.
source share