Solved

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

Posted on 2002-06-05
5
176 Views
Last Modified: 2010-03-31
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

 
0
Comment
Question by:alagor
  • 3
5 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 100 total points
ID: 7056690
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
 
LVL 35

Expert Comment

by:girionis
ID: 8834032
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
 
LVL 35

Expert Comment

by:girionis
ID: 8847242
 Hello alagor, you should accept bobbit31's answer, since he provided the solution fr you :-)
0
 

Author Comment

by:alagor
ID: 8847411
upps , sorry girionis ,
hit the wrong button , i fear

0
 
LVL 35

Expert Comment

by:girionis
ID: 8847499
 Never mind... Please ask a question here: http://www.experts-exchange.com/Community_Support/ for zero points to correct the mistake :-)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now