Well, the problem is as follows.
When programming with neatbeans and running the program everything works fine ... I create a folder and a .txt file as it should be, but, after creating the application installer and installing it (in C :) I do not create any folder or txt file.
I do not know if the problem is because you have to give some administrative permissions or something in the code so you can create the files, etc.
I am a novice in programming and any comments I thank you in advance.
- The address is correct -
In theory if the folder does not exist it would create it Here the code:
public class respaldo {
JFileChooser selector = new JFileChooser(System.getProperty("user.dir"));
String user="root";
String pass="";
String password="";
String host ="localhost";
String bd="veterinaria";
String path="C:/xampp/mysql/bin/mysqldump.exe";
String backup="mysqldump --user="+user+" --password="+password+" -v "+bd+" > "+path;
private String extension=".sql";
Runtime rt = Runtime.getRuntime();
String dir;
correo c = new correo();
String nombrearchivo ;
public void respaldar(){
Date fecha = new Date();
SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
dir=""+selector.getCurrentDirectory();
try {
File fl=new File(dir);
File fl2= new File(dir,"respaldos");
fl2.mkdir();
File file=new File(fl2,formateador.format(fecha));
nombrearchivo = file.getName();
path=file.getAbsolutePath()+extension;
JOptionPane.showMessageDialog(null,path);
String command = "C:/xampp/mysql/bin/mysqldump --user="+user+" --password="+pass+" "+bd+" -r"+path;
rt.exec(command);
} catch (IOException ex) {
Logger.getLogger(respaldo.class.getName()).log(Level.SEVERE, null, ex);
}
}