0

My problem is with a project where I use the POI library. It's from apache and allows you to work with excel,word, ... . I had to add some jar files to my library and it runs perfect. The problem is when I put my JAR file somewhere else. It gives me the errors it can't find the librarys. Is there a way I can put my librarys into the 1 jar?

I already tried to add my lib folder as source package but that didn't help.

enter image description here enter image description here

4 Answers4

0

there is a Maven plugin for Eclipse called M2Eclipse, which will read a POM and construct a classpath out of jars it finds in the local repository and any remote repositories you've configured. It behaves largely like Maven does in terms of finding the latest version for a given jar (if you've specified a version range in your POM).

You can also have a look on this http://fredpuls.com/site/softwaredevelopment/java/deploy/five_strategies_for_managing_j.htm

Zubair Nabi
  • 1,016
  • 7
  • 28
0

NetBeans builds your application into the project's dist folder. There is also a readme file in it, that tells you, you should distribute the contents of that folder...

Edit

Remove the lib folder, that is shown on the second image, from your sources.

Usagi Miyamoto
  • 6,196
  • 1
  • 19
  • 33
  • Well I use netbeans and there is no read me in it. And I don't want to sent the whole folder to someone I just want to send them the jar. – Bert Vervaele Apr 06 '17 at 13:02
  • If the type of the project is application, there is a `dist/README.TXT` after building, witch contains the following line: To distribute this project, zip up the dist folder (including the lib folder) and distribute the ZIP file. – Usagi Miyamoto Apr 06 '17 at 13:08
0

You want to make a 'shaded' or 'uber' jar, which has all of its dependencies included

There is a maven plugin for building a shaded jar.

https://maven.apache.org/plugins/maven-shade-plugin/

Daniel Scott
  • 7,418
  • 5
  • 39
  • 58
0

For me the fastest/ easiest solution was to just open my project in eclips and export is a runable JAR then it adds the librarys to the JAR.