谁能建议我一种让正在运行的 JAR 文件将自身复制到特定目录的方法?
谢谢
这是我正在尝试的:
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class ahker {
public static void main(String[] args) throws IOException {
File inputFile = new
File(ahker.class.getProtectionDomain().getCodeSource().getLocation().getFile());
File outputFile = new File("C:\\TEST.jar");
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1)
out.write(c);
in.close();
out.close();
}
}
它给了我以下编译错误:
Exception in thread "main" java.io.FileNotFoundException:
C:\Users\---------------\bin (Access is denied)