I can create a jar executable with Eclipse. Let them say that it is called ast.jar , and the main class is ASTExplorer. I can verify that this works with java -jar ast.jar .
Then I unzip the jar file into a separate directory and verify that ASTExplorer is in the astexplorer directory. But when I java -cp . astexplorer.ASTExplorer this java -cp . astexplorer.ASTExplorer java -cp . astexplorer.ASTExplorer , I get this error.
java -cp . astexplorer/ASTExplorer Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Composite at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
The fact is that there is no org / eclipse / swt directory in the jar file.

What is the magic behind the jar executable? Why doesnβt it start when unpacking?
source share