I am using One-Jar to combine my application and its dependencies into one jar file. I used the command line approach step by step. However, when running the jar file with java -jar one-jar.jar I recieve the following
error:
Exception in thread "main" java.lang.ClassNotFoundException: com.webtest.hc.Main
at com.simontuffs.onejar.JarClassLoader.findClass(JarClassLoader.java:713)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at com.simontuffs.onejar.JarClassLoader.loadClass(JarClassLoader.java:630)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.simontuffs.onejar.Boot.run(Boot.java:336)
at com.simontuffs.onejar.Boot.main(Boot.java:168)
Here is my boot-manifest.mf :
Manifest-Version: 1.0
Main-Class: com.simontuffs.onejar.Boot
One-Jar-Main-Class: com.webtest.hc.Main
and i followed the exact same instruction as it is in the One-Jar website
Your JAR is packaged incorrectly. The message error says Java can't find the One-Jar loader, which is
com.simontuffs.onejar.Bootso you somehow ended up with a malformed archive even if you tried to follow the instructions on the One-Jar site.How do I know that the JAR is malformed?
Well, from the JVM message we can guess you miss the following files if you try and open the JAR with a ZIP viewer:
How do I fix the packaging process?
It depends and we don't have the sources so can't tell. As a personal recommendation, I use Gradle as a build tool and it's well integrated with IDEs (Eclipse and Intellij) and Capsule, an alternative to One-Jar.