File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes copy error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "copy error" Watch "copy error" New topic

copy error

kumar hai

Joined: Oct 12, 2009
Posts: 26
I am copy few file to one location...file size is 25 bytes after copy this file,bytes value changed.after copy that file size is 102 bytes. Please tell me how to avoid this error..i want original size only...

im using:

<copy includeemptydirs="true" todir="${temp.dir}" preservelastmodified="true">
<fileset dir="${src1.dir}" includes="**/MANIFEST.MF"/>

please reply me waiting for your reply
Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

What's changed about that file? Have the contents changed?

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

It's possible that you're doing a text file copy under Windows of a text file that was created in Unix. That would increase the size, size Unix considers a single end-of-line character to be a sufficient indicator, but DOS/Windows uses 2.

Although that's an awful lot of end-of-lines, if that's the case.

Since the files are small, compare them and see what's different.

An IDE is no substitute for an Intelligent Developer.
kumar hai

Joined: Oct 12, 2009
Posts: 26
that file is like header file..& i hope that file created in Window only...

& also while generate ear file or war file im include this file also...that time only i getting this size increase issue...

sorry for previously i mentioned while copy only i got this issue...

real issue...while generate war/ear file i am getting size increase issue...

Peter Johnson

Joined: May 14, 2008
Posts: 5852

25 bytes to 102 bytes? Sounds like a conversion from ASCII to 4-byte Unicode, with a 2-byte byte-order-marker at the start of the file. If you have a hex editor, you can use it to verify this. This is probably happening because of the locale settings in your computer. I suspect that such settings can be changed on the JVM command line (you will have to edit ant.bat to apply them), but I don't know what they are.

See the "Important Encoding Note:" at the end of the copy task in the ant docs.

JBoss In Action
I agree. Here's the link:
subject: copy error
It's not a secret anymore!