cancel
Showing results for 
Search instead for 
Did you mean: 

Import

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Bob,

Can you paste the content of the batch file?

Thanks,

RICHARD

Former Member
0 Kudos

ImportManagerBatch /INI C:\test.ini /CLIENT MDM /MAP "TEST" /LANGUAGE "English[US]"

Former Member
0 Kudos

Use this:

Process proc = rt.exec(cmd,null,new File("path to import batch installation"));

Eg., Process proc = rt.exec(cmd,null,new File("c:/Program Files/SAP MDM 5.5/Import Manager/"));

Import Manager batch requires that command to be executed in installation folder.

HTH

--

Venkat

Former Member
0 Kudos

Thank you!!

It Works.

Answers (0)