on 06-15-2006 2:40 PM
Hi,
I am trying to run the ImportManager Batch using a Java Snippet. The .bat file does work fine if I run manually.
However when trying to run the same file using a Java code it doesnt . Please anyone let me know if Iam missing something.
class TEST{
public static void main(String args[])
{
try
{
System.out.println("Running the batch script");
Runtime.getRuntime().exec(Path of .bat file);
System.out.println("Finished running the batch script");
}
catch(Exception e) {
System.out.println("Error " +e);
e.printStackTrace();
}
}
}
Thanks,
Bob
Hi Bob,
Here's what worked for me.
private void executeBatch() {
try {
String[] cmd = new String[1];
cmd[0] = "Batch.bat" ;
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(cmd);
int exitVal = proc.waitFor();
} catch (Throwable t) {
t.printStackTrace();
}
}
Hope this helps,
Richard
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Subbu,
Thank you for you reply.
The problem is this program does execute the batch file, however doesn't execute the steps in the batch file which calls the MAPs and the client.
The batch file which call the MDM server when executed separately/manually it works.
If the same batch file is calling using this java code it doesnt call the MDM server.
Thanks,
Bob.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.