Building a jar in an ant build.xml file

Hi,
i previously used netbeans to create a jar that you could doubleclick to have it automatically started (win 2000).
The jar also included other jars like log4j, jdom and so.
In Netbeans, i first made my project and those jars available via the filesystem. Then i just made a new jar, added my project and the startpoints of the other jars. For instance for the jdom.jar, i selected the org and everything beneath.
Then i generated a standard manifest file and added this line:
Main-Class: <package>/<mainclass>
This worked ok fine.
Now, for my question: i'm trying out ant and want to achieve the same as above. Building my project is not a problem. I specified the dependies on other jars like this:
  <target name="compile" depends="init" description="compile">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}">
      <classpath>
        <pathelement location="lib/jdom.jar"/>
        <pathelement location="lib/log4j-1.2.7.jar"/>
      </classpath>
    </javac>
  </target>Compiling doesn't produce an error.
However i can't seem to figure out how to build a jar where the root of each jar is included in the content of my own jar so i don't have to distribute the jars seperately.
This is what i had so far for my jar:
  <target name="dist" depends="compile" description="generate" >
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}/lib"/>
    <!-- Put everything in ${build} into customer-${DSTAMP}.jar file -->
    <jar jarfile="${dist}/lib/customer-${DSTAMP}.jar"
         basedir="${build}" manifest="${conf}/manifest.mf"/>
  </target>My manifest file:
Manifest-Version: 1.0
Main-Class: customer/clientAny idea of how to add the content of another jar to my own jar?
Thanks

Hhhm. stupid me, i found a sollution to this and it was on this very forum!
This is the relevant thread:
http://forum.java.sun.com/thread.jsp?forum=31&thread=281090

Similar Messages

  • Ant for the build.xml file

    when we give the ant command then what the background task perform?..
    how ant start parsing the build.xml file ?

    Go to ant.jakarta.org. They have numerous tutorials. Do some research first. If you run into an actual problem, then post what it is.
    - Saish

  • Converting build.cmd to Ant build.xml file

    Can anyone help me convert the attached build command file (windows) to a
              build.xml file for Ant?
              Thanks,
              Matt
              [build.txt]
              

    Hi Kevin,
    You can get lots of help from the following links
    http://help.sap.com/saphelp_nw04/helpdata/en/e1/8e51341a06084de10000009b38f83b/frameset.htm
    SAP XI - Where to Find Information
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/sap xi - where to find information.pdf
    Following is the link for 'how to guides', A step by step guide to create scenarios:
    https://websmp201.sap-ag.de/nw-howtoguides
    All the information you need in XI :
    http://help.sap.com/saphelp_nw04/helpdata/en/0f/80243b4a66ae0ce10000000a11402f/frameset.htm
    you can also go through the url for Elearning :
    https://www.sdn.sap.com/sdn/elearning.sdn
    To understand the architecture of XI, Please go through this link,
    http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
    XI is all about configuration of Adapters, to learn more please go through this link:
    http://help.sap.com/saphelp_nw04/helpdata/en/0d/5ab43b274a960de10000000a114084/frameset.htm
    One of the most powerful feature of XI, Business Process Management:
    http://help.sap.com/saphelp_nw04/helpdata/en/3c/831620a4f1044dba38b370f77835cc/frameset.htm
    Once you go through these links and are a bit aware what all XI objects do, you can try a simple "File to File Scenario" which would help you to understand XI objects in a much better manner.
    For help on this scenario go through this blog it is in two parts thus i am providing both links below:
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
    Re: new to netweaver
    Re: how  use XSLT maping in XI
    Re: IDOC - XI - FILE scenario
    Regards
    Vishnu

  • Help -- Who has experience with ant and build.xml files ?

    Hi,
    I think my build.xml file is missing setting a classpath I need, but I have never played around with a build.xml file. Could someone help ?
    Thank you.
    Grazia

    A lot of people here use ant. But not all of us can read your mind, and those of us that can are sadistic bastards that like to force people to provide details of their problems just for the hell of it.
    So please do the following:
    * Go through an ant tutorial or other introductory docs, doing an example or two if present.
    * Set up your build.xml according to what you've learned.
    * If it still doesn't work, post the relevant portions of it (hopefully you'll have a small, representative sample that reproduces the problem), along with your relevant directory and file structure, the command you're running, and what error messages you're getting.

  • How to run JDev's generated build.xml file(BPEL project) from command win.?

    hi all
    When I execute build.xml file of simple BPEL project from JDev it runs properly. But when I try to execute it from normal command window It gives me an following error.
    ...........droping jar file xyz.jar from path as i doesn't exists.
    While all jar files are exist there.But Ant drops it from Classpath variable.
    So JDev sets some environment before executing such build.xml file.Like {oracle.home} variable u need to set while runnig build.xml from command window.
    Any suggestions...???
    /mishit

    you cant run a .war file from command prompt
    .war files should be executed in a server
    how to execute a single servlet class
    do you mean to run the servlet or compile the servlet?
    any way you need a server and if you are a beginner Apache tocat will be the best server to start with you can down load it from
    http://tomcat.apache.org/

  • Unable to create build.xml file

    I wrote build.xml file to create build using ANT in eclipse but it failed. The reason is value for "location" attribute (see below) is wrong and I don't know how to fix it. My eclipse workspace is in D:/eclipse/workspace...............but the eclipse software is in C:/eclipse....by inspection I can see that in the plugins directory in c:/eclipse there is paskage/folder named org.eclipse.jdt.core_3.0.0 which has a jar file named JDTCompilerAdapter.jar. Does the "location" attribute need to refer to this location ? If yes then how should I specify the path as I think hardcoding isn't a solution. I mean I obviously can't say
    location="C:\eclipse\plugins\org.eclipse.jdt.core_3.0.0\org.eclipse.jdt.core_3.0.0.JDTCompilerAdapter"/>
    Please advise !!
    <?xml ...>
    <project name="game" default="Main Build" basedir=".">
         <property name="bin" location="bin"/>
         <property name="src" location="src"/>
         <property name="jardir" location="${bin}/lib"/>
         <property name="jarfile" location="${jardir}/game.jar"/>
         <property name="build.compiler"
              location="org.eclipse.jdt.core_3.0.0.JDTCompilerAdapter"/>

    I'm not exactly sure what you're doing here, but I don't think any of that stuff belongs in the Ant build.xml. That should be generic, something you can run either inside or outside Eclipse.
    The compiler that's used can be specified in Eclipse when you set up paths for Ant. That doesn't belong inside the build.xml itself.

  • "Build.xml file not exist"

    Hey Guys,
    i am currently involving in a servelet project (RendreX). i want to install apachi ant as a prerequirement. i am using windows 2003 server. I already downloded latest ant version and apache tomcat4.0. Also i have set all the class path,ANT-HOME(C:\ANT) and other relevent paths. But when i run ant command in the command prompt(C:\ANT>ant)will generate error state that "build.xml" file can't be found. Have i done any wrong thing here? Can anybody give a way that i can easily install apache ant on winows.
    It would be greatly appriciated if u can send me some advice to over come this problem.
    Best Regards
    Mohan

    build.xml is the default build file assumed by ant. You have to provide a build file to control what you expect from ant to do.

  • How to create a build.xml file ??

    Hi there,
    I am learning j2ee at the moment. I have been throught the tutorial and got everything working (finally). however, now that I have started writing my own code, I am stuck with writing the build.xml file (as this is not covered in the tutorial, it is just provided). Does anyone know a good link that will give me step by step instructions on how to create my own build.xml file for my application.
    thanks

    You need to learn ant. Go here:
    http://jakarta.apache.org/ant/
    I also recommend "Java Development with Ant" by Hatcher and Loughran, just published.

  • How to automatically generate build.xml file in eclipse?

    Hello every body,
    I am learning about ANT. e.g I have writen a very simple programme which displays output "no worries". But how can I compile it with ANT and how can I generate build.xml file using eclipse.

    This is not really a Java issue but rather is an Eclipse issue. You may wish to look for their support sites or forums.

  • About the build.xml file in EJB's

    Hi,
    I want to know where is the DTD for the build.xml file in the EJB examples.
    Any help in this matter is highly appreciated.

    http://jakarta.apache.org/ant/
    "satish" <[email protected]> wrote in message
    news:[email protected]..
    >
    Hi,
    I want to know where is the DTD for the build.xml file in the EJBexamples.
    >
    Any help in this matter is highly appreciated.

  • Build.xml file

    Hi
    i am building the project by using build.xml file while running build.xml file in console first line i am getting buildfile directory is xyz/abc/build.xml
    how to print this one dinamically
    please give me clear clarification

    how to print this one dinamicallyPlease elaborate your exact requirement?
    -RMishra

  • Netbeans build.xml file: is it created automatically or do we create?

    Hi all,
    I am using Net beans IDE 6.0. For projects (with existing code, new application project, etc). Should we create build.xml file or will it be created automatically. Many things like rmi compilation, running different run-time configurations, etc depends on that file. Please do help.
    (a build.xml file is created in project folder.)
    Thanx

    don't cross post:
    http://forum.java.sun.com/thread.jspa?messageID=10107245
    it's rude.
    you create it.
    %

  • Netbeans build.xml file is automatically created or should we create?

    Hi all,
    I am using Net beans IDE 6.0. For projects (with existing code, new application project, etc). Should we create build.xml file or will it be created automatically. Many things like rmi compilation, running different run-time configurations, etc depends on that file. Please do help.
    (a build.xml file is created in project folder.)
    Thanx

    don't cross post:
    http://forum.java.sun.com/thread.jspa?threadID=5265563&messageID=10107226#10107226
    it's rude.
    %

  • [svn:bz-4.0.0_fixes] 19744: Updated main build xml file to build ds-console only under sdk3 temporarily .

    Revision: 19744
    Revision: 19744
    Author:   [email protected]
    Date:     2011-01-13 11:58:13 -0800 (Thu, 13 Jan 2011)
    Log Message:
    Updated main build xml file to build ds-console only under sdk3 temporarily.
    (SDKs updated in previous CL)
    flex_sdk_3 version 3.5.0 19710
    flex_sdk_4 version 4.x-lcds-hf 19581
    Modified Paths:
        blazeds/branches/4.0.0_fixes/build.xml

    you might want to add the following to the .configure line in you pkgbuild..
    --libdir=/usr/lib/lighttpd --with-openssl=/usr/include/openssl
    This puts the libs in /usr/lib/lighttpd, much like apache does in its own dir, instead of just dumping then in the /usr/lib dir with everything else. A bit cleaner.
    Also, not sure if bzip and gzip need to be in depends line to get output compression. I will report back when I find out.
    EDIT: Made a few more modifications to lighttpd PKGBUILD and associated files. HERE

  • Antenna - problem reading in a property value from the build.xml file

    Hi
    I have declared a property in build.xml file of my project like
    <property name="debug" value="true" />I want to read the value of this property in my source code like
    //#if debug == "true"
    //#endifAbove method doesnt work. I tried using method below but it didnt work as well
    //#if ${debug} == "true"
    //#endifCan anyone please help me how can i read this value?
    Thank you

    you can get your key bytes with byte [] keyBytes = mykey.getEncoded();
    and then write your byte array in a file.
    to get back your key :
    SecretKey myKey = new SecretKeySpec(keyBytes,"TripleDES");

  • ANT build.xml file

    My build.xml must have problems, because the jar size is way smaller than the JBuilder equivalent. I think it is not including the 3rd party Jars that I want it to include.
    Additionally, it builds, but when I execute it I get strange errors indicating it can't find certain system classfiles.
    Here is the build file:
    <project name="JAutoTest" default="dist" basedir=".">
    <!-- set global properties for this build -->
    <property name="src" value="src"/>
    <property name="build" value="build"/>
    <property name="test" value="jAutoTool"/>
    <property name="dist" value="dist"/>
    <property name="doc" value="doc"/>
    <property name="Name" value="JAutoTest"/>
    <property name="packages" value="jAutoTool.*"/>
    <path id="project.class.path">
    <pathelement location="lib/"/>
    <pathelement location="jAutoTool/"/>
    <pathelement path="${java.class.path}/"/>
    </path>
    <target name="check_for_optional_packages">
    <available property="java.reflection" classname="java.lang.reflect"/>
    </target>
    <target name="prepare">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
    <mkdir dir="${test}"/>
    <mkdir dir="${doc}"/>
    </target>
    <target name="compile" depends="prepare,check_for_optional_packages">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}" debug="on" deprecation="off" optimize="on">
    <classpath refid="project.class.path"/>
    </javac>
    </target>
    <target name="genDoc" depends="compile">
    <javadoc packagenames="${packages}" sourcepath="${basedir}/${src}" destdir="${doc}" author="true" version="true" windowtitle="${Name} API" doctitle="${Name}" bottom="Copyright � 2001 Motorola, Inc. All Rights Reserved."/>
    </target>
    <target name="dist" depends="compile">
    <!-- Create the ${dist}/lib directory -->
    <mkdir dir="${dist}/lib"/>
    <!-- Put everything in ${build} into the JAutoTest-${DSTAMP}.jar file -->
    <jar jarfile="${dist}/lib/JAutoTest-${DSTAMP}.jar" basedir="${build}"
              manifest="${dist}/META-INF/MANIFEST.MF">
              <zipgroupfileset dir="lib" includes="*.jar"/>
         </jar>
    </target>
    <target name="clean">
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
    </target>
    </project>
    I have the other jars at /lib.
    The error I am getting is:
    D:\testjTool\dist\lib>java -jar *.jar
    Uncaught error fetching image:
    java.lang.NullPointerException
    at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:102)
    at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:111)
    at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.j
    ava:251)
    at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:217)
    at sun.awt.image.ImageFetcher.run(ImageFetcher.java:185)
    Thanks.

    The error I am getting is:
    D:\testjTool\dist\lib>java -jar *.jar
    Uncaught error fetching image:
    java.lang.NullPointerException
    at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:102)
    at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:111)
    at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.j
    ava:251)
    at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:217)
    at sun.awt.image.ImageFetcher.run(ImageFetcher.java:185)
    Classpath is:
    D:\testjTool>set CLASSPATH=\testjTool\build;c:\JBuilder4\lib\HTTPClient.jar;c:\J
    Builder4\lib\htmlparser.jar;c:\JBuilder4\lib\classes12;c:\JBuilder4\lib\classes12\javax.jar;c:\JBuilder4\lib\dbswing.jar;c:\JBuilder4\lib\jbcl.jar;.;
    The ant build works, but the executable is 1/2 the size of the
    JBuilder one.

Maybe you are looking for

  • Wind Table Deleting all or no Info

    Does anyone know of any documentation or have any suggestions about the Wind table?  My issue is that the Wind Table (for price changes) is deleting all or none of the information on the table.  I can get it to either delete all or none of the inform

  • Attach a link to a workflow.

    Hi Guys , Do you have the necessary steps to attach a link to purchase order in a work item, my client needs  to see the documents before approve but he wants to see them from the business workplace I was thinking to put this below Objects and Attach

  • Converting Photoshop PC license to Mac

    I have Photoshop CS5 for PC. My PC died and I'd like to instal Photoshop CS5 onto my new Mac. How can I convert the PC license to a Mac license?

  • How do i reset the "me" card in address book?

    This is stupid - but I just forgot how to do this.

  • Audio effects and transitions reference

    This question was posted in response to the following article: http://help.adobe.com/en_US/premierepro/cs/using/WS2CFD24BB-0B2B-4059-8098-D36F5EBED240.ht ml