can anyone suggest me a way to have a running JAR file copy itself to a specific directory?
Thank you
Here's what I am trying:
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();
}
}
It is giving me the following compilation error:
Exception in thread "main" java.io.FileNotFoundException:
C:\Users\---------------\bin (Access is denied)