changing or set an file-attribut from a java-source ?

is there a way to set or change the attributs of a file
from a java-source ?

if i create a new file from java-source on a sun-system is readable and writeable, but i need it also execuable


thx for any hints

 
alagorAsked:
Who is Participating?
 
bobbit31Connect With a Mentor Commented:
how bout something like this?

import java.io.*;

public class testChMod {

        public static void main(String[] args) {
           try {
                File f = new File ("./test.txt");
                f.createNewFile();

                Runtime rt = Runtime.getRuntime();
                Process p = rt.exec("chmod 777 ./test.txt");
                p.waitFor();
           } catch (Exception e) {
                e.printStackTrace();
           }
        }
}
0
 
girionisCommented:
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to bobbit31

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0
 
girionisCommented:
 Hello alagor, you should accept bobbit31's answer, since he provided the solution fr you :-)
0
 
alagorAuthor Commented:
upps , sorry girionis ,
hit the wrong button , i fear

0
 
girionisCommented:
 Never mind... Please ask a question here: http://www.experts-exchange.com/Community_Support/ for zero points to correct the mistake :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.