Estoy ejecutando esta funcion:
private void actualitzarFitxer(String agendaPathString, String agendaSecondariPath) {
File fitxerVell = new File(agendaPathString);
File fitxerNou = new File(agendaSecondariPath);
if (fitxerVell.exists()) {
Path agendaPath = Paths.get(agendaPathString);
try {
Files.delete(agendaPath); //<---------- Falla aqu al borrarlo
} catch (IOException e) {
e.printStackTrace();
}
}
fitxerNou.renameTo(fitxerVell);
}
Y me sale el siguiente error :
java.nio.file.FileSystemException: nombres\Toni\6.txt: El proceso no tiene acceso al archivo porque está siendo utilizado por otro proceso.
El problema es que en linux me funciona pero en windows no. La verdad es que estoy bastante perdido y no se como solucionarlo.
Vale ya lo he solucionado. Era un fileinpustream que no habia cerrado.