I use the idea tool to make my own Java program into an executable jar package, of course, with eclipse or directly with the jar command line does not matter, the essence is to archive the program to a compressed package, and accompanied by a description of the manifest file.
The operation of the jar is actually very simple, a lot of information on the web, even if the error tool will be prompted, and the implementation of packaged jars is prone to some small problems, these small problems are often the jar package in the inventory file written in some small details caused.
For example, I mentioned in the title of the execution jar throws Java.lang.NoClassDefFoundError exception, can not find the class under such a package, this time do not see, is the manifest file in the Classpath writing problem:
Classpath has the following easy-to-ignore issues:
(1) where there can be no blank lines and spaces the first line may not be a blank line (the first row of the row can not have a blank line), between the row and the row cannot have a blank line, the line end of line can not have spaces
(2) Be sure to have a blank line where the last line is empty (add a carriage return after you have finished your content)
(3) where there must be a space
Wait a minute. These in fact with third-party tools (non-JDK comes with) will not have problems, and I have encountered a problem, I would like to specifically explain here, I refer to online posts, with idea to play jar, third-party jar all into the Lib folder, this time, The jar package corresponding to the classpath of the manifest file must be prefixed with the "lib\", and the problem is here, when he writes Lib\xxx-xx.jar executes the jar package, there is a Java.lang.NoClassDefFoundError exception in the header. I repeatedly and the packing list file, godless a night to climb out of the pit, need to use the "/" symbol, the classpath should be Lib/xxx-xx.jar
Java-jar Execution jar Package appears java.lang.NoClassDefFoundError