Hello,
I'm working with eclipse and i've a problem to launch an Talend .bat
I want to start a Talend job behind a jbutton.
This is my code :
try {
String[] cmd = new String[3];
cmd[0]= "cmd.exe";
cmd[1]= "/C";
cmd[2]= "C:\\workspace\\Test\\TestPgmJava_run.bat";
Runtime rt = Runtime.getRuntime();
final Process proc2 = rt.exec(cmd);
new Thread() {
public void run() {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(proc2.getInputStream()));
@SuppressWarnings("unused")
String line = "";
try {
while((line = reader.readLine()) != null) {
// Traitement du flux de sortie de l'application si besoin est
System.out.println("erreurint: "+line+"\n");
}
} finally {
reader.close();
}
} catch(IOException ioe) {
ioe.printStackTrace();
}
}
}.start();
// Consommation de la sortie d'erreur de l'application externe dans un Thread separe
new Thread() {
public void run() {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(proc2.getErrorStream()));
@SuppressWarnings("unused")
String line = "";
try {
while((line = reader.readLine()) != null) {
// Traitement du flux d'erreur de l'application si besoin est
System.out.println("erreur1 : "+line+"\n");
}
} finally {
reader.close();
}
} catch(IOException ioe) {
ioe.printStackTrace();
}
}
}.start();
proc2.waitFor();
int status = proc2.exitValue();
System.out.println("valeur de retour du sous proc2: "+status);
} catch (Exception e3) {
// TODO: handle exception
e3.printStackTrace();
}
}
});
}
return jButton;
}
When i start the program i have this error message
erreurint:
erreurint: C:\workspace\Test>java -Xms256M -Xmx1024M -cp ../lib/jt400.jar;../lib/jxl.jar;../lib/systemRoutines.jar;../lib/userRoutines.jar;.;testpgmjava.jar;../lib; projet_corep.testpgmjava.TestPgmJava --context=Default
erreur1 : java.lang.NoClassDefFoundError: jxl/write/WritableWorkbook
erreur1 : Caused by: java.lang.ClassNotFoundException: jxl.write.WritableWorkbook
erreur1 : at java.net.URLClassLoader$1.run(Unknown Source)
erreur1 : at java.security.AccessController.doPrivileged(Native Method)
erreur1 : at java.net.URLClassLoader.findClass(Unknown Source)
erreur1 : at java.lang.ClassLoader.loadClass(Unknown Source)
erreur1 : at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
All the .jar are in c:\workspace\test\lib
What i'm doing wrong ?
Thanks