?
Solved

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

Posted on 2002-06-05
5
Medium Priority
?
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 400 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

741 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