This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Problems while copying an executable file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Problems while copying an executable file" Watch "Problems while copying an executable file" New topic
Author

Problems while copying an executable file

Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

I am trying to copy a compiled, execuatable file from one directory to another using ant task - copy. However, the file gets opied but its executable attribute "X" is stripped, so the file is no more executable. How can I preserve the files "X" attribute?

This is what I have used -
<copy todir="${riepath}" file="/my_source_path_here/name_of_execuatble">
</copy>

TIA,
- Manish
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
The Ant documentation suggests a solution towards the bottom of the copy task documentation.
[ July 26, 2004: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

Right! Here it is -

<quote>
Unix Note: File permissions are not retained when files are copied; they end up with the default UMASK permissions instead. This is caused by the lack of any means to query or set file permissions in the current Java runtimes. If you need a permission-preserving copy function, use <exec executable="cp" ... > instead.
</quote>

But I need something which is portable, so what's the solution?

rgds,
- Manish
 
Don't get me started about those stupid light bulbs.
 
subject: Problems while copying an executable file
 
Similar Threads
Tag file variable question
assignment JAR problem
help to includes jar files in classpath of a jar file
Problem packing with ant
Executable jar