简体   繁体   中英

Automate: export runnable jar, by Launch Configuration, Eclipse

I develop Java code using Eclipse. When I want a runnable jar I point and click in the GUI like this:

File->Export->Runnable Jar -> Launch Configuration (select MainTest) --LibraryHandling (extract required libraries into generated JAR)

I want to do this automatically, how can I do this in bash?

Depending on what is in your project and what dependencies you have, this could be pretty complex using the command line tools Java provides. The Java tutorial is pretty good in explaining the usage of the related tools that ship with Java to create jars , but I think most people suggest using a build tool like Maven or Gradle for command line builds.

If you're using the jar tool though, the most basic example for the jar tool with a runnable Main class being specified is:

jar cmf existing-manifest jar-file input-file(s)

where existing-manifest would be your manifest file that specifies your main class.

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