Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Intermediate
Jun 23, 2003

Change the Read-only Permissions of a File (JDK 1.2.2)

Use this code to change the read-only permissions of a file in JDK 1.2.2:

public void changeFilePermission(){
    String osName = System.getProperty("os.name");
    try{
        if (osName.equalsIgnoreCase("WINDOWS NT") ||
osName.equals("Windows 2000") ) {
          	Runtime.getRuntime().exec("cmd.exe /c attrib -r *.*");
        }else{
          	Process Proc = Runtime.getRuntime().exec("command.com /C
attrib -r *.*");
        }
        Thread.currentThread().sleep(100);
    }catch(Exception e){
        System.out.println(e.getMessage());
    }
  }
Ajay Arora
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date