i want to execute chmod in java code ,how?

Posted on 2005-04-12
Medium Priority
Last Modified: 2010-08-05
i want to execute chmod in java code how?,in the entree i have parameter for umask
so i must convert them into chmod parameter ,then executing chmod
thank u for ur help
Question by:laes_
  • 2
LVL 35

Accepted Solution

TimYates earned 120 total points
ID: 13760540
Runtime.getRuntime().exec( "/bin/chmod " + mask + " " + filename ) ;

should do it...
LVL 35

Expert Comment

ID: 13760546
>>  i have parameter for umask so i must convert them into chmod parameter

You can just do:

chmod 755 filename

no need to generate parameters...
LVL 86

Expert Comment

ID: 13760802
>>in the entree i have parameter for umask

Can you say a little more about this and the relation to chmod? umask is used to set initial perms on a newly created file

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month17 days, 5 hours left to enroll

864 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