cancel
Showing results for 
Search instead for 
Did you mean: 

File Premission Change from WD java Application

former_member206397
Contributor
0 Kudos

Hi All,

From Web dynpro application I am trying to change a file permission, the file located in a OS level path. My J2EE engine is running with Java 5. Can anybody provide me correct API for solving the problem for Java 5.

Thanks

Chandan

Edited by: Chandan Jash on Jan 6, 2012 5:22 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

Qualiture
Active Contributor
0 Kudos

First you need to make sure your web dynpro application has permissions to access the file in the first place, but you could use the standard java.io.File class:

File file = new File("/path/file.sh");
file.setExecutable(false);
file.setReadable(false);
file.setWritable(false);

former_member206397
Contributor
0 Kudos

Hi Robin,

I think this APIs are available in JAVA 6 but I my J2EE engine is running with JAVA 5. I am not getting setExecutable, setReadOnly and setWritable methods in Java 5.

Thanks

Chandan

Qualiture
Active Contributor
0 Kudos

Hmmm... You may want to use something like Runtime.exec("chmod 777 yourfile.sh"); but that would make it platform dependant...