I'm trying to create a file and append some information.
First thing I do is creating the folders, then I create the files.
try {
if (!new File("Results\\" + p.getName()).exists()) {
new File("Results\\" + p.getName()).mkdir();
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error creating the directory");
}
try {
PrintWriter writer = new PrintWriter ("Results\\" + p.getName() + "\\" + simulation.getNameSim(), "utf-8");
//After this instruction jumps to exception
//Code
} catch (Exception e) {
}
The variables p.getName and simulation.getName have the information. The debug says there are no erros creating the directory but after the print the program throws an exception.
Any ideas? I'm creating the files inside a java's program directory because I need to send the program to another persons and I guess its not about permissions.