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 /Cattrib -r *.*"); } Thread.currentThread().sleep(100); }catch(Exception e){ System.out.println(e.getMessage()); } }
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.
Related Posts
- Semiconductor Slump: Rebound on the Horizon
- China Unveils First Fourth-Generation Nuclear Reactor
- Date Settings Problem (Regional Settings)
- Perforce Introduces Helix GitSwarm: Flexible Git Ecosystem Mirrored to a Powerful Mainline Repository
- Carbon and emissions tech secures record $17.7B in 2023 VC investments























