简体   繁体   中英

How do i make a Jar file from an already existing Jar and my own classes?

For example I want to create a Jar file C.jar from A.Jar(like from rt.jar from Jre) and my own classes(Ex.java file). I am using Eclipse IDE.

  • If you want to create Jar file using eclipse then you can follow this link . Put your class files and existing A.jar then perform export operation to create C.jar.

  • If you want to create Jar file using cmd then use jar cf C.jar *.jar *.class command to create new Jar file with classes as well as existing A.jar.

If you are using maven to build your jar then you can make use of the maven-assembly-plugin. This plugin will build a jar that will contain your code as well as all packages contained in the project's dependencies. See here for the documentation: http://maven.apache.org/plugins/maven-assembly-plugin/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM