在源文件的a.java下的main里添加了一段代码,但是没有实现效果啊?
public static void main(String[] args) throws IOException{/*********下面是我添加的把一段string打印到txt文件的代码**********/
String s = "hello world";
PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream("hello3.txt")), true);
pw.println(s);
pw.close();
}
添加代码后重新导出的jar包,解压缩后用里面的a.class替换原来jar包里的a.class(就是用winrar打开原来的jar包,替换里面的a.class),这样行吗?
public static void main(String[] args) throws IOException{/*********下面是我添加的把一段string打印到txt文件的代码**********/
String s = "hello world";
PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream("hello3.txt")), true);
pw.println(s);
pw.close();
}
添加代码后重新导出的jar包,解压缩后用里面的a.class替换原来jar包里的a.class(就是用winrar打开原来的jar包,替换里面的a.class),这样行吗?
2、你打jar包,可以使用jar命令或者winrar(zip格式),如果工程比较多的话,建议使用ant或者maven