Exécution d'une commande qui ne fait rien en java mais marche avec la console
Bonjours !
Je suis confronté à un truc bizarre ! j'ai une commande java qui fait un import de donné sql, via un fichier passé en argument.
Quand je tape la commande dans la console DOS, ça marche nikel, mais quand j'utilise Runtime.getRuntime().exec(), ça marche pas et il n'y a aucun méssage d'érreur...
Voici le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
Properties config = getConfig();
String cmd = config.getProperty("path_mysql_bin") + "\\mysql --host=localhost" +
" --user=" + config.getProperty("idSql") +
(config.getProperty("mdpSql").equals("") ? "" : "--password=" + config.getProperty("mdpSql")) +
" myself < " + temp.getAbsolutePath();
System.out.println(cmd);
try {
Process p = Runtime.getRuntime().exec(cmd);
p.waitFor();
} catch (InterruptedException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} |
Si je récupère depuis la console java la commande exécuté, et que je l’exécute à la main, ça marche .... .Seriez-vous d'ou ce problème peux venir?? merci