Akshay
Akshay

Reputation: 2763

Unix executable corrupts when copied through Java

I am trying to copy a *.app file to my Applications folder in OS X, but when I try to do that all Unix executable files gets corrupted and turns into text files.

I have tried the following code using Apache Commons IO:

FileUtils.copyDirectoryToDirectory(FileUtils.getFile(System.getProperty("user.home") + "/Downloads/JCal.app"), FileUtils.getFile("/Applications/"));

And also I have tried using the example code.

Any idea how to get over this problem?

Upvotes: 1

Views: 70

Answers (1)

Peter Lawrey
Peter Lawrey

Reputation: 533530

A .app file is a Mac OSX specific file format and not portable to other OSes. Linux has no idea how to read the file and runs it as a script which fails as it is a binary format.

I suggest you build a .jar which can be run on any platform.

Upvotes: 1

Related Questions