ANT - Jar File include another Jar file and importing classes

Here is the directory structure i have set up:
FTPGetter
  \src
    \com
      \abc
        \ftpgetter
          - GUI.java
          - FTPGetter.java
          - Login.java
  \classes
  \include
    - ftpClient.jar
    - info.xml
  \jar
    - FTPGetter.jarThe code compiles file and can create a Jar file without errors. But when I execute the Jar file, I get
java.lang.NoClassDefFoundError: com/abc/ftpclient/FTPwhich is a class that I import from the ftpClient.jar file in FTPGetter.java
What gives?
Here is my necessary build.xml code:
<?xml version="1.0"?>
<project name="FTPGetter" default="all">
  <property name="src.dir"        value="src"/>
  <property name="package.name"   value="com.abc.ftpgetter"/>
  <property name="package.dir"    value="${src.dir}/com/abc/ftpgetter"/>
  <property name="classes.dir"    value="classes"/>
  <property name="include.dir"    value="include"/>
  <property name="jar.dir"        value="jar"/>
  <property name="javadoc.dir"    value="docs"/>
  <property name="javadoc.title"  value="FTPGetter"/>
  <property name="javadoc.header" value="FTPGetter - By ABC XYZ [2005]"/>
  <property name="run.classname"  value="${package.name}.FTPGetter"/>
  <target name="init">
    <mkdir dir="${javadoc.dir}" />
    <mkdir dir="${classes.dir}" />
    <mkdir dir="${jar.dir}" />
  </target>
  <target name="all" depends ="compile,jar" />
  <target name="compile" description="Compile Java code" depends="clean, init">
    <javac srcdir="${package.dir}" destdir="${classes.dir}">
      <classpath>
        <!-- use the value of the ${classes.dir} property in the classpath -->
        <pathelement path="${classes.dir}" />
        <!-- include all jar files  -->
        <fileset dir="${include.dir}">
          <include name="**/*.jar"/>
        </fileset>
      </classpath>
    </javac>
  </target>
  <target name="clean" description="Clean up">
    <delete dir="${javadoc.dir}" />
    <delete dir="${classes.dir}" />
    <delete dir="${jar.dir}" />
  </target>
  <target name="jar" depends="compile">
    <jar jarfile="${jar.dir}/FTPGetter.jar" update="false">
      <fileset dir="${classes.dir}" includes="**/*.class" />
<!-- Include xml file to read.-->
      <fileset dir="${include.dir}" includes="info.xml" />
<!-- Include ftpClient in the jar file.-->
      <fileset dir="${include.dir}" includes="ftpClient.jar" />
      <manifest>
        <attribute name="Main-Class" value="com.abc.ftpgetter.FTPGetter" />
        <attribute name="Class-Path" value="include/ftpClient.jar"/>
      </manifest>
    </jar>
  </target>
</project>

nevermind I got that fixed now:
had to get the build.xml code for the <target name="jar" depends="compile">so that it looks more like:
  <target name="jar" depends="compile">
    <jar jarfile="${jar.dir}/FTPGetter.jar">
      <zipfileset dir="classes" prefix="" />
      <zipfileset src="include/ftpClient.jar" />
      <zipfileset dir="${include.dir}" includes="info.xml" />
      <manifest>
        <attribute name="Main-Class" value="com.abc.ftpgetter.FTPGetter" />
      </manifest>
    </jar>
  </target>Keyword would need to be zipfileset.

Similar Messages

  • ANT how to include NetBeans Jar  files in my script of ANT ??

    ANT how to include NetBeans Jar files in my script of ANT ??

    I mean the library say swing layout ...
    which is SwingLayOuts1.0.jar ...
    in side this there is folder org.jDesktop....
    I want this folder in my jar file ...
    also ....
    My question ... i know the path of the jar file of NetBeans .... i can copy that ...dirctly ... but if m using Netbeans editor ... can i give NetBeans class to my jar command for ANT...........

  • Executing .jar files from another .jar file.

    How would I run one .jar file from another .jar file. and is there anyway to call specific class arguments? Because I have one .jar file that reads a specified file and returns its contents.
    So how would I execute it and specify its arguments and how would I make it return something to the executing jar file?

    Because I have one .jar file that reads
    a specified file and returns its contents. Presumably you have a class that does that, and you have that class stored in a jar. And you want to know how to... um... do something with that class. I say "um..." because normally you don't execute a class, either, you either call its static methods or you create an instance of the class and call its instance methods.
    If you have been writing a whole lot of little classes each of which just has a static main method, then stop doing that. Write real Java classes instead. The tutorial is here:
    http://java.sun.com/docs/books/tutorial/java/index.html

  • I have a Windows 7 laptop using I tunes 64 and all my music files are on an external disc. I rarely use I tunes and at one point moved all my files (including the music files) from one external disc to another without considering what affect this wou

    I have a Windows 7 laptop using I tunes 64 and all my music files are
    on an external disc. I rarely use I tunes and at one point moved all my files
    (including the music files) from one external disc to another without
    considering what affect this would have on the I tunes library. When I eventually
    attempted to use I tunes, every selected a song from the library resulted in a
    message stating that the file couldn't be located. After following some of the procedures
    explained in this community I was able to reconnect the library back to where
    the associated music files are presently stored. However, there are still 2
    problems that need to be corrected. 1) Every song file now has a duplicate. One
    file works and the other file will result in the same message stating that the
    file couldn't be located. Before there were 4,000 songs in the library, now
    there are 8,000 songs. I need to eliminate the 4,000 dead song files. 2) All
    the playlists are still associated with the dead song files which makes the
    playlists unusable. Can the playlists be reconnected to the usable files
    without manually having to recreate them? Thanks in advance for the help.
    sdkr

    So am I understanding correctly?
    You used your iPod as a hard drive (drag and drop) instead of having iTunes install the music?
    If you used drag and drop your choices are different than if you used iTunes to transfer.
    Good luck!

  • How to Include a ZUL file in another ZUL file

    Hi
    I need to Include a ZUL file in another ZUL file
    which is not in same JAR. Both are in different JAR.. but i want to Include that...!
    Thanks...!

    You want to include a ZUL file, whatever that is, that's in one JAR inside another ZUL file that's in another JAR? I don't even understand the question. Get it out of the first JAR and include it inside the 2nd ZUL file ???

  • Include another xml file in web.xml

    I was able to use XML Entity to include another xml file in web.xml for older servlet specifications, i.e.:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd" [
      <!ENTITY my-web SYSTEM "my-web.xml">
    ]>
    <web-app>
      &my-web;
    </web-app>This allows me to share my-web.xml among various web applications.
    How do I achieve the same thing for servlet specification 2.5, which does not have a DTD but rather an XSD?
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      id="WebApp_ID" version="2.5">I am using Glassfish V2UR1. I know about $domain-dir/config/default-web.xml, but for reasons I won't get into I cannot put things in there.

    Hi Maksim. I understood that. It's just that I would prefer some method that doesn't require the developers to do something like extracting a file from the EAR file, changing the file and then putting it back in. As you probably know, some developers could handle it and some will most certainly make mistakes.
    When they do they come to my group and say "my app doesn't work" and then we have to spend time figuring out why.
    Plus, once the developers get used to doing things the automated way they're going to have a hard time remembering to do a manual step each time they do a build.
    I have heard that there may be some way to do something similar to this on Visual Administrator. I'm going to investigate that too.
    Thanks!
    David.

  • None of my apple apps can export files, including Mail, iPhoto, Aperture and Preview.

    None of my apple apps can export files, including Mail, iPhoto, Aperture and Preview. When I try to export a file from any of these programs, the app hangs for a few seconds and then does nothing, not even open an export dialogue. Same thing happens when I try to attach a file to an email. Also, maybe related and maybe not, Photoshop will crash after the splash screen. All of these app function properly when using a different User Account.
    I've tried deleting my application preferences in my user library and when that didn't work, I deleted my account and then created a new one that used the same user directory, which still didn't fix anything.
    I don't really want to make a new user from scratch and have to re-enter license numbers, re-calibrate monitors, recover bookmarks, contancts, etc. etc. if I don't have to, so I would be grateful for any advice.
    Thanks!
    System: Early 2008 Mac Pro, 3GHz 8 Core with 12 GB RAM, Nvidia GTX 285 (mac edition). Running OS X 10.8.4

    You cannot change your iCloud email address but you can setup a new alias: http://help.apple.com/icloud/#/mm6b1a490a
    You cannot transfer purchases from one AppleID to another.

  • Copy one text file to another text file and delete last line

    Hi all wonder if someone can help, i want to be able to copy one text file to another text file and remove the last line of the first text file. So currently i have this method:
    Writer output = null;
             File file = new File("playerData.xml");
             try {
                   output = new BufferedWriter(new FileWriter(file, true));
                   output.write("\t" + "<player>" + "\n");
                   output.write("\t" + "\t" + "<playerName>" + playerName + "</playerName>" + "\n");
                   output.write("\t" + "\t" + "<playerScore>" + pointCount + "</playerScore>" + "\n");
                   output.write("\t" + "\t" + "<playerTime>" + minutes + " minutes " + seconds + " seconds" + "</playerTime>" + "\n");
                   output.write("\t" + "</player>" + "\n");
                   output.write("</indianaTuxPlayer>" + "\n");
                  output.close();
                  System.out.println("Player data saved!");
             catch (IOException e) {
                   e.printStackTrace();
              }However each time the method is run i get the "</indianaTuxPlayer>" line repeated, now when i come to read this in as a java file i get errors becuase its not well formed. So my idea is to copy the original file, remove the last line of that file, so the </indianaTuxPlayer> line and then add this to a new file with the next data saved in it. So i would end up with something like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <indianaTuxPlayers>
         <player>
              <playerName>Default Player</playerName>
              <playerScore>0</playerScore>
              <playerTime>null minutes null seconds</playerTime>
         </player>
         <player>
              <playerName>Default Player</playerName>
              <playerScore>0</playerScore>
              <playerTime>null minutes null seconds</playerTime>
         </player>
         <player>
              <playerName>Default Player</playerName>
              <playerScore>0</playerScore>
              <playerTime>null minutes null seconds</playerTime>
         </player>
    </indianaTuxPlayers>
    However after all day searching the internet and trying ways, i have been unable to get anything working, could anyone give me a hand please?

    I would go the XML route too, but for fun, open a file as a BufferedWriter and do this:
    void copyAllButLastLine(File src, BufferedWriter tgt) throws IOException {
        BufferedReader in = new BufferedReader(new FileReader(src));
        try {
            String previous= in.readLine();
            for (String current = null; (current = in.readLine()) != null; previous=current) {
                tgt.write(previous);
                tgt.newLine();
        } finally {
            in.close();
    }

  • How can I copy layers from one .fla file to another .fla file?

    Hi,
    How can I copy layers from one .fla file to another .fla file? Please do help.
    Thanks.

    Select all the frames you want to copy, right click and select copy frames then select the file you want to paste them into and right click again and then paste frames.
    The layers the frames are should come across with them.

  • Trying to compile a .java file from another .java file

    Hello,
    I'm trying to compile a .java file from another .java file using Runtime.exec...
    String c[]=new String[3];
    c[0]="cmd.exe"; c[1]="/c" ; c[2]="javac Hello.java";
    Process p=Runtime.exec(c);
    If anyone can help me in atleast getting the command prompt when Runtime.exec("cmd.exe") is executed...that would be great...I tried out notepad.exe, calc, explorer instead of cmd.exe...all the commands display their respective windows..except cmd.exe...the command prompt doesnt appear...
    Please help me ASAP....
    Thanks for your help in advance...
    Regards.
    AKhila.

    try this. ur code will be compliled and will get .class file. but console won't appear. is it a must for u?
    public class Exec{
         public static void main(String a[]) throws Exception{
              String c[]=new String[3];
              c[0]="cmd.exe"; c[1]="/c" ; c[2]="javac Hello.java";
              Process p=Runtime.getRuntime().exec(c);
              // or Runtime.getRuntime().exec("javac Hello.java");

  • Pooling data from an XML file to another XML file using File Adapter

    Hi,
    I am trying to Pool data from an XML file to another XML file using File Adapter. I have added "Target Namespace" in both the XML and XSD.The problem is "At the destination given in the FileAdapter" only a blank XML file is created and it doesnot have any data.
    Kindly suggest me some methods
    Thanks in Advance.

    Ok here is a solution with external tables.
    SQL> CREATE DIRECTORY my_xml_dir AS 'E:\oracle\Log_files\UTL_AKIVATST'
    2 /
    Directory created.
    SQL> DROP TABLE my_xml_et
    2 /
    Table dropped.
    SQL> CREATE TABLE my_xml_et
    2 ( EMPNO NUMBER,
    3 EMPNAME VARCHAR2(10),
    4 JOB VARCHAR2(10),
    5 HIREDATE DATE,
    6 SAL NUMBER
    7 )
    8 ORGANIZATION EXTERNAL
    9 (
    10 TYPE ORACLE_LOADER
    11 DEFAULT DIRECTORY my_xml_dir
    12 ACCESS PARAMETERS
    13 (
    14 records delimited by "</EMP>"
    15 badfile my_xml_dir:'empxt%a_%p.bad'
    16 logfile my_xml_dir:'empxt%a_%p.log'
    17 FIELDS
    18 (
    19 filler char(2000) terminated by "<EMP>",
    20 EMPNO char(2000) enclosed by "<EMPNO>" and "</EMPNO>",
    21 EMPNAME char(2000) enclosed by "<ENAME>" and "</ENAME>",
    22 JOB char(2000) enclosed by "<JOB>" and "</JOB>",
    23 HIREDATE char(2000) enclosed by "<HIREDATE>" and "</HIREDATE>",
    24 SAL char(2000) enclosed by "<SAL>" and "</SAL>"
    25 )
    26 )
    27 LOCATION ('emp.xml')
    28 )
    29 PARALLEL
    30 REJECT LIMIT UNLIMITED
    31 /
    Table created.
    SQL> SELECT * FROM my_xml_et
    2 /
    EMPNO EMPNAME JOB HIREDATE SAL
    7369 SMITH CLERK 17-DEC-80 800
    7499 ALLEN SALESMAN 20-FEB-81 1600
    This is the XML file i used emp.xml
    <EMPLOYEES>
    <EMP>
    <EMPNO>7369</EMPNO>
    <ENAME>SMITH</ENAME>
    <JOB>CLERK</JOB>
    <HIREDATE>17-DEC-80</HIREDATE>
    <SAL>800</SAL>
    </EMP>
    <EMP>
    <EMPNO>7499</EMPNO>
    <ENAME>ALLEN</ENAME>
    <JOB>SALESMAN</JOB>
    <HIREDATE>20-FEB-81</HIREDATE>
    <SAL>1600</SAL>
    <COMM>300</COMM>
    </EMP>
    </EMPLOYEES>
    Use this external table to insert into your table.
    Thanks,
    Karthick.

  • Pages Importing from pages file to another pages file

    Is it possible to Import from a separate pages file to another pages file
    IF so HOW?????

    Tulse, I'm using Pages 2 too. The first thing I'd tried this on had only a simple drop cap in a text box, fixed on page. That didn't copy - or at any rate didn't paste. The text box had been sent back to overlay it with inline spaces to clear the capital. These reproduced, but the capital didn't. Neither did kerning or baseline adjustments, nor my inserted guides for "leading" the text to the same depth on every page
    Also page set-up details were not transferred in this way: i.e., if you change the margins in a template (even the blank one) the margins don't transfer. Logical enough, page set-up belongs to the document, not the section.
    Looking at this again, in the Extreme Newsletter template, imported graphics transferred, and inserted text transferred, but layering and placement information did not. I'd made my own pages by altering this, generally using text boxes or shapes to compose picture pages rather than using those in the template. But the copied and pasted sections were all over the place.
    So it may be the case that if you're copying from a section to a document with identical layout, page set-up & etc. to the one you're copying from, the result will contain most of the content. But the layering, placement on page of fixed objects, etc., would seem to be decidedly iffy.
    I've tried it on title page sections, where the info in fixed text boxes copied, but neither their placement nor relative placement, and (in the newsletter template) with both my own and the provided sections, with no consistent results. If it works in some cases, then that would be handy.
    It's easy enough to try, and undo if it doesn't work.
    But it's certainly no subsitute for being able to insert one Pages document into another; nor even always bits of it. I'd be inclined to conclude that copying and pasting in this way uses something less than the full Pages file format.
    Cheers.
    iBook G4   Mac OS X (10.4.7)  

  • Insert pdf file into another pdf file keeps getting stuck

    I am trying to insert a 5 page pdf file into another pdf file (both unsecured) and it keeps getting stuck at about 71%* conplete. I can't even get the file to show up on the screen so i can close it. Help?

    I have tried several different files, and get the same phenomenon with each one –
    1.     I open an acrobat file.
    2.     I open a WORD file.
    3.     I copy a sentence from WORD to the clipboard.
    4.     I click on View in Acrobat, Tools, Pages, other options, insert from clipboard.
    5.     Acrobat shows that it is copying, and when it gets to 67% it stops and runs and runs and then only way I can stop it is to go to the task manager and end task.
    I tried refrying with a file and that didn’t work, and I can’t imagine that Acrobat was designed so that each time I try to insert from WORD I would have to refry (even if it did work).
    Please help!
    Thank you
    Shirah
    Moadim LeSimcha, times of joy!

  • Move group of pages from one InDesign file to another InDesign File using VB.Script

    Dear team,
    I am trying to move group of InDesign pages from one indesign file to another indesign file using vb.script.
    I have written the code like
    Dim Pages=IndDoc.Pages
    Dim Mytype=TypeName(Pages)
    Pages.Move(InDesign.idLocationOptions.idBefore,IndDoc1.Pages.LastItem)
    but it is giving an error as method Move is not a member of Pages 
    please give mme the solution to move the Multiple pages or a group of page from one Indd to another Indd.

    Hey Peter, if I wan to move several page that part of Auto Flow text, I checked the "delete page after moving" but the content still there, not deleted.
    Is there any way to delete it automatically, just to make sure I have moved that autoflowed page?

  • How can I insert a completed file into another PDF file I am developing?

    How can I insert a completed file into another PDF file I am developing?

    Please refer : http://acrobatusers.com/tutorials/how-to-insert-a-pdf-into-a-pdf

Maybe you are looking for

  • Is it possible to put form fields on layers in Acrobat?

    I am creating evaluation forms that have 3 layers. Basically, on page 1 there are 3 buttons for the apprpriate category, and each button turns on a specific layer. The following pages have information to be filled out based on which category layer is

  • Flat File to DB then back to Flat File

    I need to compare the contents of a flat file with two columns in a db table. Then do an insert into the db if there is a difference between the two and the do a select of the latest data on the db then write it to a file. I need help urgently, thats

  • Keeping library/playlists when only some files moved?

    lost a hard drive unfortunately so many of my itunes files are now not found, with the big ole grey exclamation mark. i had the music i cared about on my ipod, and recovered that, but now if i just import that into my library i will have doubles and

  • How can I enlarge view in pages

    Okay, so how do I enlarge my view. The only thing I ever liked about WORD was being able to enlarge a page to 125% or a full page view. I love Pages, but how do I enlarge my view so I can see what I am typing better?

  • Why doesnt pogo games play in firefox 4 they always did before now i need to use ie9

    pogo games always played well in fire fox until version 4 games play well in internet explorer 9 no problems web pages work fine just the games dont load