I'm making a GUI for a CLI program and when this event is activated the jLabel4 text instantly changes to Task: Finished Exporting.
Why is the .exec(...); command not working? It's not the command syntax, I tried replacing my command with touch new.file and that doesn't work either.
To me it seems like it doesn't event try to execute the command.
Java Code:
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
if (ext[1].equals("iso") || ext[1].equals("wbfs")) {
String tmpPath = "";
if (jtPath.indexOf(".") > 0)
tmpPath = jtPath.substring(0, jtPath.lastIndexOf("."));
Process p;
try {
p = Runtime.getRuntime().exec("wit extract \"" + jtPath + "\" \"" + tmpPath + "\"");
p.waitFor();
jLabel4.setText("Task: Exporting...");
p.destroy();
} catch (IOException ex) {
Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
} catch (InterruptedException ex) {
Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println("wit extract \"" + jtPath + "\" \"" + tmpPath + "\"");
jLabel4.setText("Task: Finished Exporting");
} else {
JOptionPane.showMessageDialog(null, "You can only extract .iso and .wbfs file formats.");
}
}
Command Line Output:
wit extract "/home/adam/Wii Hacking/NSMBW SMNE01.wbfs" "/home/adam/Wii Hacking/NSMBW SMNE01"
p.waitFor();.