Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I wrote my Java application in Eclipse. Now I would like to generate a .jar file which can be run on other systems from the command line. Is there a easy way to do it in Eclipse?

In particular I am wondering what should I do with the jar files of external library that I use (should it be included into my .jar file?).

Moreover, should I generate some manifest files?

ADDED:

I see the window in which I can choose "Extract required libraries into generated JAR" or "Package required libraries into generated JAR" and so on. I select the first option, I specify export destination but "Next" button is not activated yet. What else should I specify. I am offered to launch a configuration but i do not want to. Every configuration is associated with a fixed set of parameters given in the command line and I do not want that.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
200 views
Welcome To Ask or Share your Answers For Others

1 Answer

Select you project, then Export => Java => Runnable JAR file

You can then choose to extract/package/copy required libraries into your JAR and also select the class, whose main() method should be executed on startup.

Then you can execute the generated jar via: java -jar yourjar.jar


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...