Generating a Jar in Eclipse including external library

前端 未结 3 889
悲哀的现实
悲哀的现实 2020-12-06 20:59

I have a java application I\'ve written in eclipse. It works fine there.

It works fine run from a command line in the directory where I export it to. In that direc

相关标签:
3条回答
  • 2020-12-06 21:36

    Eclipse has its own Jar export wizard for generate a runnable jar packed with required library or with the required library in a folder aside the jar.

    Going in File ---> Export then choose Java - Runnable Jar

    export

    You can then choose how pack the jar and how handling libraries :

    Jar packing

    You can also save the ant script for later modification or use ...

    0 讨论(0)
  • 2020-12-06 21:43

    You actually should use Ant or Maven for your task, I see no other option. Ant is already packed with eclipse, you only need to install a JDK, not only a JRE.

    Ant is very easy to learn and you can find billions of examples in the internet. With ant you can do exactly what you want.

    Maven is the more up-to-date way to build and package jars and do much more other stuff. Maven also is a good choice for you.

    0 讨论(0)
  • 2020-12-06 21:49

    I'll second a vote for Maven. Eclipse has a decent maven integration (m2eclipse). Then check out this answer for building the jar effectively using Maven2

    Building a runnable jar with Maven 2

    0 讨论(0)
提交回复
热议问题