When you publish a javase project, you often need to make the project a jar package, and when you have dependencies on Third-party jar packs in your project, you need to resolve the classpath issues about the Third-party jar packs when you package your own projects. Here's how to achieve these goals under eclipse:
In the project needs to export the jar file class, such as the above Testjar.java on the right click, select Export, how to change the file has main function, select runnable jar file,
Select Copy, need to rely on the package to the subdirectory, select Finish, export complete, should be able to see Myjar.jar and a directory myjar_lib, in the Myjar_lib directory, storing all the project dependencies.
Use the decompression software to view the MAINFEST.MF in the Myjar.jar file
You can see the Class-path entry, followed by the dependency package, included. (current directory), because I used the log4j, so copy log4j.properties file to, and Myjar.jar the same directory
As shown in the figure above, you can then execute your own project under CMD, Java-jar Myjar.jar.