Code:
Exception in thread "main" java.io.FileNotFoundException: C:\Users\Valentin\Desktop (Zugriff verweigert)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at Autostart.copyFile(Autostart.java:22)
at Autostart.main(Autostart.java:14)
Das ist die Fehlermeldung wenn ich dieses Programm ausführe:
Java:
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
public class Autostart {
public static void main(String[] args) throws IOException {
File inF = new File("C:/Users/Valentin/Desktop/hs_err_pid1144.log");
File outF = new File("C:/Users/Valentin/Desktop");
copyFile(inF, outF);
}
public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = null;
FileChannel outChannel = null;
try {
inChannel = new FileInputStream(in).getChannel();
outChannel = new FileOutputStream(out).getChannel();
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOException e) {
throw e;
} finally {
try {
if (inChannel != null)
inChannel.close();
if (outChannel != null)
outChannel.close();
} catch (IOException e) {}
}
inChannel.close();
outChannel.close();
}
}
Brauche dringend Hilfe!
Danke im vorraus..
Vale
Zuletzt bearbeitet von einem Moderator: