LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to run linux command from java program? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-run-linux-command-from-java-program-253165/)

ranger225 11-10-2004 06:10 AM

how to run linux command from java program?
 
hi friendz,
i wrote a java program in which is creating a file using the "File" class.... but after creating it i want to change the permissions of tht file.......i.e. i want to run "chmod" command from java.... does any pone know how to do it? or is there any other way to do it using File class or some other class?.....

bye....

aizkorri 11-10-2004 06:55 AM

you can do it like:

Runtime r =Runtime.getRuntime();
Process changePermissions=r.exec("chmod whatever pathToWhateverFile");
changePermissions.waitFor();

hope this helps


All times are GMT -5. The time now is 11:11 PM.