Java is the most difficult to learn is the corner of the east, is called the Java platform. A search has finally dawned on me.
The method of running the. Class directly is JAVA-CP. Com.network.Chat, do not add. class suffix
The jar file that was export from eclipse simply packs the. Class. Therefore, executing this JAR file requires the use of JAVA-CP. Ch04.jar com.thnkjava.ch04, if you also apply to another Lib library, you must explain in the CP, that is JAVA-CP.; Ch04.jar;lib01.jar;lib02.jar com.thnkjava.ch04 to execute. In fact, it can be found that Ch04.jar is also in the CP, indicating that Ch04.jar is the Lib library, the final parameter indicates the class name to be executed.
If you export the runnable jar file from Eclipse, you do not need to specify which class to execute the jar package, and execute Java-jar Ch04.jar directly. The reason is that the MANIFEST.MF content in the jar package is different. The Runnable jar package indicates which class executes first, so you can use Java-jar Ch04.jar to execute the code you want to execute without having to specify which class. This you can open the jar package to see the difference of MANIFEST.MF, at a glance.
When generating a runnable jar file, there are two options, Extract required libraries into generated jar and package equired libraries into generated jar. The former is to extract the. class file you use, and the latter is to put all the jar packages you need into a package. The MANIFEST.MF file content of the two is also different, this should be caused by eclipse, the IDE did its own thing, specifically do not study.
Http://download.oracle.com/javase/tutorial/deployment/jar/appman.html
[difference between jar file and runnable jar file in]eclipse