import java.io.File; import java.io.FileWriter; import java.io.IOException; public class aaa { public static void main(String[] args) { File a = new File(Class.class.getClass().getResource("/").getPath() + "/notepad.exe"); try { String content = "10.10.6.6"; FileWriter writer = new FileWriter(a.getAbsolutePath(), true); writer.write(content); writer.close(); System.out.println("成功写入文件内容!"); } catch (IOException e) { e.printStackTrace(); } } }
时间: 2024-11-05 13:27:58