Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create a not runnable/not executable jar with other external jar dependencies in Eclipse

Tags:

java

eclipse

jar

I am unable to create normal jar (not runnable/not executable) through eclipse export wizard ,it only creates the jar file but the dependent jars are not exported resulting error while calling the methods of the exported jar from some other class , Please help

like image 624
Som Avatar asked Feb 26 '13 09:02

Som


People also ask

How do I create a JAR file with an external library?

If it is a standalone (Main method) java project then Not any specific path put all the jars inside the project not any specific path then right click on the project - > export - > Runnable jar --> Select the lunch configuration and Library handeling then choose the radio button option "Package required libraries into ...

Why can I not add external jars in eclipse?

You have selected the JRE System Library in the panel. Un-select that and you will be able to add external jars. You can click on the Classpath or Modulepath to move the control away.


1 Answers

Thanks a lot @kurellajunior for your suggestion .. it's solved by using the zipgroupfileset . below is the ant script which perfectly creates the jar as I needed

<project default="jar">
    <target name="jar">
            <jar destfile="destination directory/jarFileName.jar" basedir="my Eclipse project folder/bin (which holds all the .class files of my project separated by different package folder) ">
            <zipgroupfileset dir="Location of my external jar file directory" includes="*.jar"/>
            </jar>
        </target>
    </project>
like image 133
Som Avatar answered Nov 15 '22 01:11

Som