IntelliJ Java IDE
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
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply 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: 2559

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: 2559

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
 
 
subject: Problems while copying an executable file
 
Threads others viewed
Problem packing with ant
help to includes jar files in classpath of a jar file
assignment JAR problem
Tag file variable question
Executable jar
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture