Error while runing a executable from JAVA
Hi,
I am trying to run a exe file from Java...I am geting the following exception
*******************************
java.io.IOException: CreateProcess: BOP.exe -e GT13E2M_E32_G21 error=2
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at afops.appActions.simulation.run.BOPSolver.runBOP(BOPSolver.java:37)
at afops.actions.SimulationStartAction.startRunForBasicBDDNormalCalc(SimulationStartAction.java:227)
at afops.actions.SimulationStartAction.actionPerformed(SimulationStartAction.java:105)
at afops.components.MyToolbar$EventRedirector.actionPerformed(MyToolbar.java:198)
************************************************************************
Following the piece of code
String workingDir = BenchConstants.workDir
+ BenchConstants.separator
+ ownedFrom.getDataBlock().getGTdir();
String command ="BOP.exe -e "+ownedFrom.getDataBlock().getGTdir().trim();
//String command = workingDir + BenchConstants.separator
//+ "BOP.exe -e " +workingDir + BenchConstants.separator +ownedFrom.getDataBlock().getGTdir();
File dir =new File(workingDir);
Runtime rt = Runtime.getRuntime();
String line;
String errLine;
System.out.println("Run Command string is : "+command);
Process pr = rt.exec(command,null,dir);
Here File object dir points to the Dir where the exe file is located and where the command to be run.....
Thanks & regards
Karthik

