I am new to Java and learn how to export applications to .jar files. I created a simple Java application in Eclipse with several tutorial-based classes from Eclipse and Java for all beginners .
When I launch my application through Run -> Run in Eclipse, my application starts without exception. However, when I got to the file -> Export and export my application to a .jar file, and then do
java myLibrary.jar
in my Mac terminal, I get this output from a standard error.
Exception in thread "main" java.lang.NoClassDefFoundError: myLibrary/jar
Caused by: java.lang.ClassNotFoundException: myLibrary.jar
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)
What does it mean? How do I skip classes? I tried to check and uncheck the boxes for export. For example, I tried to enable my JUnit tests to no avail.