I tried to rename the file using the code I found here:
File newFile = new File(oldFile.getParent(), "new-file-name.txt"); Files.move(oldFile, newFile);
Now I have done the following:
private void stFiles() { System.out.println("sorting"); File f = new File (getName()); name = getName() + counter.toString(); System.out.println(f.getName()); File newFile = new File(f.getParent(), getName()+ ".jpg"); try { Files.move(f, newFile); } catch (IOException ex) { System.out.println("made file"); } counter +=1; }
Now I get a printout of the "made file", which means that there is an IO exception. However, the stack trace is not readable.
What is the reason for this?
source share