0

I have copied the required JAR file for using org.apache.commons.io.FileUtils in /lib directory of my Project. And added this in classpath as well.

Once I build the project and run it from IntelliJ IDE, the application works fine. But when I Build it as Artifact, it creates a JAR file for my application. If I run the JAR file, the APIs from org.apache.commons.io.FileUtils are not working...!!

I think something wrong with adding the external JAR file to my project. Please help..!

-Younus

mipa
  • 10,369
  • 2
  • 16
  • 35
  • 5
    Recommended to use build tools like Maven that would make life easier than manually copying jar files. – Pradeep Simha Feb 13 '17 at 11:03
  • run the jar from the project itself, jar file will not add external libraries in it. – Bhavik Patel Feb 13 '17 at 11:10
  • You will need to use some kind of tool to build a "fat-jar" that contains all your resources - such as libraries in the shape of jar-files. Both ant, maven and/or gradle may help you with this issue. Example can be found here: https://www.mkyong.com/ant/ant-create-a-fat-jar-file/ – vegaasen Feb 13 '17 at 11:54
  • Please ensure that class-path in manifest includes the required libraries. You can open a jar file using unzip utilities and investigate that it contains all the libraries. You will find instruction in previous stackoverflow discussion regarding building jar files. – Prabir Ghosh Feb 13 '17 at 14:11

0 Answers0