Program is getting hanged

This is my Batch file

@echo off

cls

echo Input File : %1.xml

echo Output File : %1Converted.xml

D:\Tool\converter\executables\exe\amp.exe %1.xml

set CP=\\ ... \saxon8-jdom.jar;\\ ... \saxon8-sql.jar;\\ ... \saxon8sa.jar;\\ ... \saxon-license.lic

java -cp %CP% net.sf.saxon.Transform -o %1Converted.xml %1.xml D:\ ... \xslFile.xsl

:exit

@echo on

In the above batch file, thexslFile.xsl is converting1.xml to1Converted.xml. If I run this batch file manually, the needed1Converted.xml is getting created from1.xml without any problem. But if I execute the same batchfile through my following code, my program is getting hanged. Could anyone please tell me where am I wrong.

This is my source code

publicstaticvoid main(String args[])

{

File xmlFile=new File("D:\\temp\\filename.xml");

String xmlFile1=xmlFile.toString();

String xmlFile2=xmlFile1.substring(0,xmlFile1.lastIndexOf("."));

Main m =new Main();

m.finalExe3(xmlFile2);

}

publicvoid finalExe3(String inputfile)

{

File file =new File(inputfile);

File fil =new File(file.getParent());

Runtime rt = Runtime.getRuntime();

try

{

String tempiso ="cmd /c D:\\temp\\batchfile.bat \""+inputfile+"\"";

Process procsrniso = rt.exec(tempiso, null, fil);

System.out.println("Executing FinalUpd..........."+inputfile);

String processline;

DataInputStream srnisoexelineip1 =new DataInputStream(procsrniso.getInputStream());

try

{

processline="";

String out="";

while ((processline = srnisoexelineip1.readUTF()) !=null)

{

out+=processline+"\n";

System.out.println(processline);

}

if(out.length()>0)

{

System.out.println(out);

}

}

catch (IOException e)

{

System.out.println("Error Fetching Information From batchfile.bat");

System.exit(0);

}

procsrniso.waitFor();

if(procsrniso.exitValue()==0)

{

DataInputStream srnisoexelineer =new DataInputStream(procsrniso.getErrorStream());

try

{

processline="";

String out="";

while ((processline = srnisoexelineer.readUTF()) !=null)

{

out+=processline+"\n";

System.out.println(processline);

}

if(out.length()>0)

{

javax.swing.JOptionPane.showMessageDialog(null,"Final Update Execution Problem \n"+out);

}

}

catch (IOException e)

{

System.out.println("Error Executing Final Update");

System.exit(0);

}

processline="";

}

else

{

DataInputStream srnisoexelineer =new DataInputStream(procsrniso.getErrorStream());

try

{

processline="";

String out="";

while ((processline = srnisoexelineer.readUTF()) !=null)

{

out+=processline+"\n";

System.out.println(processline);

}

if(out.length()>0)

{

javax.swing.JOptionPane.showMessageDialog(null,"Final Update Execution Problem \n"+out);

}

}

catch (IOException e)

{

System.out.println("Error Executing Final Update");

}

}

}

catch (Exception e)

{

System.out.println("Error at Final Update file Execution.");

}

}

[5910 byte] By [Java_Persona] at [2007-11-27 9:38:31]
# 1
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.htmlI'm sure it waits for the process stream to be read.
CeciNEstPasUnProgrammeura at 2007-7-12 23:12:02 > top of Java-index,Java Essentials,New To Java...
# 2

> http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-

> traps.html

>

> I'm sure it waits for the process stream to be read.

I am sorry to say even after reading from the site mentioned by you, I am still not able to trace out my problem. As mentioned earlier my source code hangs and the necessary execution is not happening. But if I terminate the execution of my program, then the necessary output is created. Please help me with my code.

Java_Persona at 2007-7-12 23:12:02 > top of Java-index,Java Essentials,New To Java...
# 3
> Process procsrniso = rt.exec(tempiso, null, fil);tryProcess procsrniso = rt.exec(tempiso);Did you try to verify the ErrorInputStream ?Did you put some debugs, like System.out.println("here1");cya
pbulgarellia at 2007-7-12 23:12:02 > top of Java-index,Java Essentials,New To Java...