简体   繁体   中英

How to create runnable jar from multiple eclipse files?

Title; I have two different classes/java files, one driver and one class. How can I create a runnable jar with both of these files? When I tried exporting as a runnable jar in eclipse, it only let me choose one file as my "launch configuration" (not sure what that means). When I tried to run the .jar it wouldn't work.

Thanks!

Sadly, you can't.

In Order to create a runnable JAR, A META-INF/MANIFEST.MF File must be created inside the JAR. And the File specification only allows one Main Class for JAR.

The best approach that I can give you (to resolve this) is to create in conjunction with your JAR File, two scripts. Each of them, calling one of your Main Classes through the command console.

Or see if you can define two launching configuration file for the same project from eclipse...

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