Java is the most difficult to learn. It is called Java platform. After searching, I finally understood it.
Directly run the. Class Method Java-CP. com. Network. Chat without adding the. Class suffix
From the JAR file of Export in eclipse, only. Class is packaged. Therefore, Java-CP .; ch04.jar COM. thnkjava. ch04. If you still apply it to another lib library, you must describe it in CP, that is, Java-CP .; ch04.jar; lib01.jar; lib02.jar COM. thnkjava. ch04. In fact, it can be found that ch04.jar is also in CP, indicating that ch04.jar is the Lib library, and the final parameter specifies the class name to be executed.
If runnable JAR file is export from eclipse, you do not need to specify the class when executing this jar package. You can directly execute Java-jar ch04.jar in this way. The reason is that the manifest. MF content in the jar package is different. The runnable jar package specifies the class to be executed first, so you can use Java-jar ch04.jar to executeCodeWithout specifying the specific class. You can open the jar package to view the differences between manifest. MF.
When generating runnable JAR file, there are two options: extract required libraries into generated jar and package equired libraries into generated jar. The former extracts the. Class file you use, and the latter extracts all the jar packages you need into a package. The content of the manifest. MF file is different between the two. This should be caused by eclipse. Ide does its own thing and will not study it in detail.
Http://download.oracle.com/javase/tutorial/deployment/jar/appman.html