Solved

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

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 157
web application structure 18 128
Session in java desktop 5 34
How to find out if all executorservice threads have finished 2 7
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 …
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

738 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