intellij idea java文件只读不可编辑怎么解决?

intellij idea java文件只读不可编辑怎么解决?,第1张

你这边应该是文件吵烂不小心点告旁击到了锁定文件。打开锁定文件的窗口,选择File如图选项升友漏:

解锁则选择Make File Writeable

package com.yiibai

import java.io.File

import java.io.IOException

public class FileReadAttribute

{

public static void main(String[] args) throws IOException

{

File file = new File("c:/file.txt")

/逗卖/肆猛mark this file as read only, since jdk 1.2

file.setReadOnly()

if(file.canWrite()){

System.out.println("This file is writable")

}else{

System.out.println("This file is read only")

}

//revert the operation, mark this file as writable, since jdk 1.6

file.setWritable(true)

if(file.canWrite()){

System.out.println("This file is writable")

}else{

System.out.println("山雹逗This file is read only")

}

}

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/12300451.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-24
下一篇 2023-05-24

发表评论

登录后才能评论

评论列表(0条)

保存