Java

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Failed to execute task move in Windows

    5 answers - 3811 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Windows file systems are case-insensitive while being case-preserving; if
    all you want to do is to change the case you'll need to use an
    intermediate file (i.e. move to temp_Bi.jar, then move to Bi.jar).
    Jeffrey E. (Jeff) Care
    carej (AT) us (DOT) ibm.com
    IBM WebSphere Application Server Development
    WAS Pyxis Lead Release Engineer
    Leon Pu <leon_xf_pu (AT) yahoo (DOT) com.cnwrote on 05/10/2006 10:13:32 AM:
    Hi all,
    my build file with task move failed in Windows, but the same build file
    works in Linux. Could anybody tell me why?
    [build-script]
    <project default="test">
    <target name="test">
    <move file="bi.jar" tofile="Bi.jar" />
    </target>
    </project>
    [build-script]
    [error-message]
    Apache Ant version 1.6.5 compiled on June 2 2005
    Buildfile: build.xml
    Detected Java version: 1.4 in: C:\java\jdk\j2sdk1.4.2_09\jre
    Detected S: Windows 2000
    parsing buildfile C:\Documents and
    Settings\Administrator\Desktop\build.xml with
    URI =
    file:///C:/Documents%20and%
    Project base dir set to: C:\Documents and
    Settings\Administrator\Desktop
    Build sequence for target(s) `test' is [test]
    Complete build sequence is [test, ]
    test:
    [move] Moving 1 file to C:\Documents and
    Settings\Administrator\Desktop
    [move] Attempting to rename: C:\Documents and
    Settings\Administrator\Deskto
    p\bi.jar to C:\Documents and Settings\Administrator\Desktop\Bi.jar
    [move] Copying C:\Documents and
    Settings\Administrator\Desktop\bi.jar to C:
    \Documents and Settings\Administrator\Desktop\Bi.jar
    BUILD FAILED
    C:\Documents and Settings\Administrator\Desktop\build.xml:3: Failed to
    copy C:\D
    ocuments and Settings\Administrator\Desktop\bi.jar to C:\Documents and
    Settings\
    Administrator\Desktop\Bi.jar due to C:\Documents and
    Settings\Administrator\Desk
    top\bi.jar (The system cannot find the file specified)
    at (Move.java:274)
    at (Move.java:226)
    at
    (Move.java:153)
    at (Copy.java:430)
    at
    (UnknownElement.java:275)
    at (Task.java:364)
    at (Target.java:341)
    at (Target.java:369)
    at
    (Project.java:1216)
    at
    (Project.java:1185)
    at
    (DefaultExe
    cutor.java:40)
    at
    (Project.java:1068)
    at (Main.java:668)
    at (Main.java:187)
    at (Launcher.java:246)
    at (Launcher.java:67)
    Caused by: java.io.FileNotFoundException: C:\Documents and
    Settings\Administrato
    r\Desktop\bi.jar (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at
    (FileUtils.java:630)
    at (Move.java:262)
    15 more
    Nested Exception
    java.io.FileNotFoundException: C:\Documents and
    Settings\Administrator\Desktop\b
    i.jar (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at
    (FileUtils.java:630)
    at (Move.java:262)
    at (Move.java:226)
    at
    (Move.java:153)
    at (Copy.java:430)
    at
    (UnknownElement.java:275)
    at (Task.java:364)
    at (Target.java:341)
    at (Target.java:369)
    at
    (Project.java:1216)
    at
    (Project.java:1185)
    at
    (DefaultExe
    cutor.java:40)
    at
    (Project.java:1068)
    at (Main.java:668)
    at (Main.java:187)
    at (Launcher.java:246)
    at (Launcher.java:67)
    Total time: 1 second
    [error-message]
    Best regards,
    Leon
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com
    To unsubscribe, e-mail: user-unsubscribe (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
  • No.1 | | 689 bytes | |

    Jeffrey,

    Thank you for the insight: you are absolutely right!

    I'm still a bit mystified though. When my target and property were set like this:

    <property name="path" value="C:\Documents and Settings\Administrator\Desktop" description="Path to jar which is to be renamed"/>

    <target name="rename" description="Rename file.">
    <move file="${path}\bi.jar" tofile="${path}\Bi.jar" />
    </target>

    the task failed and claimed that bi.jar could not be found; when I checked the directory, the jar file had been DELETED!! What's that all about? I could see the rename failing but why would Ant and/or Windows DELETE the file?
  • No.2 | | 883 bytes | |

    I've not look at the code behind the move targetbut I would guess
    it's java.io.File? If sonot sure why it would do that either
    <confused;)

    Rhino wrote:
    Jeffrey,

    Thank you for the insight: you are absolutely right!

    I'm still a bit mystified though. When my target and property were set
    like this:

    <property name="path" value="C:\Documents and
    Settings\Administrator\Desktop" description="Path to jar which is to
    be renamed"/>
    <target name="rename" description="Rename file.">
    <move file="${path}\bi.jar" tofile="${path}\Bi.jar" />
    </target>

    the task failed and claimed that bi.jar could not be found; when I
    checked the directory, the jar file had been DELETED!! What's that all
    about? I could see the rename failing but why would Ant and/or Windows
    DELETE the file?
  • No.3 | | 7702 bytes | |

    The problem is that the move task delete the destination before moving
    the file, so I let you guess what happens in this case.

    Anthony
    Scot P. Floess wrote:

    I've not look at the code behind the move targetbut I would guess
    it's java.io.File? If sonot sure why it would do that either
    <confused;)

    Rhino wrote:
    >
    >Jeffrey,
    >
    >Thank you for the insight: you are absolutely right!
    >
    >I'm still a bit mystified though. When my target and property were
    >set like this:
    >
    ><property name="path" value="C:\Documents and
    >Settings\Administrator\Desktop" description="Path to jar which is to
    >be renamed"/>
    ><target name="rename" description="Rename file.">
    ><move file="${path}\bi.jar" tofile="${path}\Bi.jar" />
    ></target>
    >
    >the task failed and claimed that bi.jar could not be found; when I
    >checked the directory, the jar file had been DELETED!! What's that
    >all about? I could see the rename failing but why would Ant and/or
    >Windows DELETE the file?
    >
    >--
    >Rhino
    >
    >>

    >Message
    >*From:* Jeffrey E Care <mailto:carej (AT) us (DOT) ibm.com>
    >*To:* Ant Users List <mailto:user (AT) ant (DOT) apache.org>
    >*Sent:* Wednesday, May 10, 2006 11:05 AM
    >*Subject:* Re: Failed to execute task move in Windows
    >>
    >>

    >Windows file systems are case-insensitive while being
    >case-preserving; if all you want to do is to change the case
    >you'll need to use an intermediate file (i.e. move to temp_Bi.jar,
    >then move to Bi.jar).
    >
    >
    >>
    >>

    >Jeffrey E. (Jeff) Care
    >_carej (AT) us (DOT) ibm.com_ <mailto:carej (AT) us (DOT) ibm.com>
    >IBM WebSphere Application Server Development
    >WAS Pyxis Lead Release Engineer
    >WebSphere Mosiac
    >WebSphere Brandmark
    >>
    >>
    >>
    >>

    >Leon Pu <leon_xf_pu (AT) yahoo (DOT) com.cnwrote on 05/10/2006 10:13:32 AM:
    >>

    >Hi all,
    >>

    >my build file with task move failed in Windows, but the same
    >build file
    >works in Linux. Could anybody tell me why?
    >>

    >[build-script]
    ><project default="test">
    ><target name="test">
    ><move file="bi.jar" tofile="Bi.jar" />
    ></target>
    ></project>
    >[build-script]
    >>

    >[error-message]
    >Apache Ant version 1.6.5 compiled on June 2 2005
    >Buildfile: build.xml
    >Detected Java version: 1.4 in: C:\java\jdk\j2sdk1.4.2_09\jre
    >Detected S: Windows 2000
    >parsing buildfile C:\Documents and
    >Settings\Administrator\Desktop\build.xml with
    >URI =
    >>

    >
    >file:///C:/Documents%20and%
    >Project base dir set to: C:\Documents and
    >Settings\Administrator\Desktop
    >Build sequence for target(s) `test' is [test]
    >Complete build sequence is [test, ]
    >>

    >test:
    >[move] Moving 1 file to C:\Documents and
    >Settings\Administrator\Desktop
    >[move] Attempting to rename: C:\Documents and
    >Settings\Administrator\Deskto
    >p\bi.jar to C:\Documents and Settings\Administrator\Desktop\Bi.jar
    >[move] Copying C:\Documents and
    >Settings\Administrator\Desktop\bi.jar to C:
    >\Documents and Settings\Administrator\Desktop\Bi.jar
    >>

    >BUILD FAILED
    >C:\Documents and Settings\Administrator\Desktop\build.xml:3:
    >Failed to
    >copy C:\D
    >ocuments and Settings\Administrator\Desktop\bi.jar to
    >C:\Documents and
    >Settings\
    >Administrator\Desktop\Bi.jar due to C:\Documents and
    >Settings\Administrator\Desk
    >top\bi.jar (The system cannot find the file specified)
    >at
    >(Move.java:274)
    >at
    >(Move.java:226)
    >at
    >(Move.java:153)
    >at
    >(Copy.java:430)
    >at
    >
    >(UnknownElement.java:275)
    >at (Task.java:364)
    >at (Target.java:341)
    >at
    >(Target.java:369)
    >at
    >
    >(Project.java:1216)
    >at
    >(Project.java:1185)
    >at
    >>

    >
    >(DefaultExe
    >cutor.java:40)
    >at
    >(Project.java:1068)
    >at (Main.java:668)
    >at (Main.java:187)
    >at
    >(Launcher.java:246)
    >at
    >(Launcher.java:67)
    >Caused by: java.io.FileNotFoundException: C:\Documents and
    >Settings\Administrato
    >r\Desktop\bi.jar (The system cannot find the file specified)
    >at java.io.FileInputStream.open(Native Method)
    >at
    >java.io.FileInputStream.<init>(FileInputStream.java:106)
    >at
    >(FileUtils.java:630)
    >at
    >(Move.java:262)
    >15 more
    >Nested Exception
    >java.io.FileNotFoundException: C:\Documents and
    >Settings\Administrator\Desktop\b
    >i.jar (The system cannot find the file specified)
    >at java.io.FileInputStream.open(Native Method)
    >at
    >java.io.FileInputStream.<init>(FileInputStream.java:106)
    >at
    >(FileUtils.java:630)
    >at
    >(Move.java:262)
    >at
    >(Move.java:226)
    >at
    >(Move.java:153)
    >at
    >(Copy.java:430)
    >at
    >
    >(UnknownElement.java:275)
    >at (Task.java:364)
    >at (Target.java:341)
    >at
    >(Target.java:369)
    >at
    >
    >(Project.java:1216)
    >at
    >(Project.java:1185)
    >at
    >>

    >
    >(DefaultExe
    >cutor.java:40)
    >at
    >(Project.java:1068)
    >at (Main.java:668)
    >at (Main.java:187)
    >at
    >(Launcher.java:246)
    >at
    >(Launcher.java:67)
    >>

    >Total time: 1 second
    >[error-message]
    >>
    >>

    >Best regards,
    >Leon
    >>

    >
    >Do You Yahoo!?
    >Tired of spam? Yahoo! Mail has the best spam protection around
    >http://mail.yahoo.com
    >>
    >>

    >
    >
    >To unsubscribe, e-mail: user-unsubscribe (AT) ant (DOT) apache.org
    >For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
    >>
    >>

    >
    >
    >No virus found in this incoming message.
    >Checked by AVG Free Edition.
    >Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date:
    >09/05/2006
    >>

    >
    >>

    >No virus found in this outgoing message.
    >Checked by AVG Free Edition.
    >Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date:
    >09/05/2006
    >>

    >
    >
    >>

    >
    >To unsubscribe, e-mail: user-unsubscribe (AT) ant (DOT) apache.org
    >For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
    >
    >


    To unsubscribe, e-mail: user-unsubscribe (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
  • No.4 | | 6891 bytes | |

    Ahyeahright :|

    Well the world would be a better place if everyone just ran Linux ;)

    Anthony Goubard wrote:
    The problem is that the move task delete the destination before moving
    the file, so I let you guess what happens in this case.

    Anthony
    Scot P. Floess wrote:
    >
    >I've not look at the code behind the move targetbut I would guess
    >it's java.io.File? If sonot sure why it would do that either
    ><confused;)
    >>

    >Rhino wrote:
    >>

    Jeffrey,

    Thank you for the insight: you are absolutely right!

    I'm still a bit mystified though. When my target and property were
    set like this:

    <property name="path" value="C:\Documents and
    Settings\Administrator\Desktop" description="Path to jar which is to
    be renamed"/>
    <target name="rename" description="Rename file.">
    <move file="${path}\bi.jar" tofile="${path}\Bi.jar" />
    </target>

    the task failed and claimed that bi.jar could not be found; when I
    checked the directory, the jar file had been DELETED!! What's that
    all about? I could see the rename failing but why would Ant and/or
    Windows DELETE the file?

    --
    Rhino

    Message
    *From:* Jeffrey E Care <mailto:carej (AT) us (DOT) ibm.com>
    *To:* Ant Users List <mailto:user (AT) ant (DOT) apache.org>
    *Sent:* Wednesday, May 10, 2006 11:05 AM
    *Subject:* Re: Failed to execute task move in Windows

    Windows file systems are case-insensitive while being
    case-preserving; if all you want to do is to change the case
    you'll need to use an intermediate file (i.e. move to temp_Bi.jar,
    then move to Bi.jar).

    Jeffrey E. (Jeff) Care _carej (AT) us (DOT) ibm.com_
    <mailto:carej (AT) us (DOT) ibm.com>
    IBM WebSphere Application Server Development WAS Pyxis
    Lead Release Engineer
    WebSphere Mosiac WebSphere Brandmark

    Leon Pu <leon_xf_pu (AT) yahoo (DOT) com.cnwrote on 05/10/2006 10:13:32 AM:

    Hi all,
    >

    my build file with task move failed in Windows, but the same
    build file
    works in Linux. Could anybody tell me why?
    >

    [build-script]
    <project default="test">
    <target name="test">
    <move file="bi.jar" tofile="Bi.jar" />
    </target>
    </project>
    [build-script]
    >

    [error-message]
    Apache Ant version 1.6.5 compiled on June 2 2005
    Buildfile: build.xml
    Detected Java version: 1.4 in: C:\java\jdk\j2sdk1.4.2_09\jre
    Detected S: Windows 2000
    parsing buildfile C:\Documents and
    Settings\Administrator\Desktop\build.xml with
    URI =
    >


    file:///C:/Documents%20and%
    Project base dir set to: C:\Documents and
    Settings\Administrator\Desktop
    Build sequence for target(s) `test' is [test]
    Complete build sequence is [test, ]
    >

    test:
    [move] Moving 1 file to C:\Documents and
    Settings\Administrator\Desktop
    [move] Attempting to rename: C:\Documents and
    Settings\Administrator\Deskto
    p\bi.jar to C:\Documents and
    Settings\Administrator\Desktop\Bi.jar
    [move] Copying C:\Documents and
    Settings\Administrator\Desktop\bi.jar to C:
    \Documents and Settings\Administrator\Desktop\Bi.jar
    >

    BUILD FAILED
    C:\Documents and Settings\Administrator\Desktop\build.xml:3:
    Failed to
    copy C:\D
    ocuments and Settings\Administrator\Desktop\bi.jar to
    C:\Documents and
    Settings\
    Administrator\Desktop\Bi.jar due to C:\Documents and
    Settings\Administrator\Desk
    top\bi.jar (The system cannot find the file specified)
    at
    (Move.java:274)
    at
    (Move.java:226)
    at

    (Move.java:153)
    at
    (Copy.java:430)
    at

    (UnknownElement.java:275)
    at (Task.java:364)
    at (Target.java:341)
    at
    (Target.java:369)
    at

    (Project.java:1216)
    at
    (Project.java:1185)
    at
    >


    (DefaultExe
    cutor.java:40)
    at
    (Project.java:1068)
    at (Main.java:668)
    at (Main.java:187)
    at
    (Launcher.java:246)
    at
    (Launcher.java:67)
    Caused by: java.io.FileNotFoundException: C:\Documents and
    Settings\Administrato
    r\Desktop\bi.jar (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at
    java.io.FileInputStream.<init>(FileInputStream.java:106)
    at
    (FileUtils.java:630)
    at
    (Move.java:262)
    15 more
    Nested Exception
    java.io.FileNotFoundException: C:\Documents and
    Settings\Administrator\Desktop\b
    i.jar (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at
    java.io.FileInputStream.<init>(FileInputStream.java:106)
    at
    (FileUtils.java:630)
    at
    (Move.java:262)
    at
    (Move.java:226)
    at

    (Move.java:153)
    at
    (Copy.java:430)
    at

    (UnknownElement.java:275)
    at (Task.java:364)
    at (Target.java:341)
    at
    (Target.java:369)
    at

    (Project.java:1216)
    at
    (Project.java:1185)
    at
    >


    (DefaultExe
    cutor.java:40)
    at
    (Project.java:1068)
    at (Main.java:668)
    at (Main.java:187)
    at
    (Launcher.java:246)
    at
    (Launcher.java:67)
    >

    Total time: 1 second
    [error-message]
    >
    >

    Best regards,
    Leon
    >


    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com
    >
    >


    To unsubscribe, e-mail: user-unsubscribe (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
    >


    No virus found in this incoming message.
    Checked by AVG Free Edition.
    Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date:
    09/05/2006

    No virus found in this outgoing message.
    Checked by AVG Free Edition.
    Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date:
    09/05/2006

    To unsubscribe, e-mail: user-unsubscribe (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
    >>
    >>

    >
    >


    To unsubscribe, e-mail: user-unsubscribe (AT) ant (DOT) apache.org
    For additional commands, e-mail: user-help (AT) ant (DOT) apache.org
    --
  • No.5 | | 534 bytes | |

    Thank you for shedding light on this, Anthony!

    Now I understand why the file disappeared.

    At the very least, there should be a big note in the article for the move
    task warning that the file will be deleted in these circumstances but I'd be
    a LT happier if this behaviour were FIXED, not just noted. It certainly
    feels like a bug - and a very serious one! - to me. Deleting a file
    unexpectedly could be catastrophic. Just imagine someone trying to rename
    the Windows registry and deleting it instead!

Re: Failed to execute task move in Windows


max 4000 letters.
Your nickname that display:
In order to stop the spam: 7 + 7 =
QUESTION ON "Java"

EMSDN.COM