Solved

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

Posted on 2002-06-05
5
178 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
reasons why a "inside Menu" would not appear for a web server 6 56
micro services vs rest web services 16 87
ArrayIndexOutOfBoundException 9 68
rhino JavaScript import, load 25 69
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
The viewer will learn how to implement Singleton Design Pattern in Java.

861 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

24 Experts available now in Live!

Get 1:1 Help Now