RSS Forums RSS
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 698 | Replies: 2
Reply
Join Date: Apr 2006
Posts: 4
Reputation: uth is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
uth uth is offline Offline
Newbie Poster

any suggestions please-Runtime problem

  #1  
Apr 19th, 2006
I am trying to execute a batch file which in turn executes an exe and writes output to a file, through java. I do not know why but the output file is not always written. Sometimes the program terminates without writing the file and sometimes it does. Any suggestions? Is there anyway i can wait till the execution of the batch file is complete?Will be great if somebody can help!thanks.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2006
Posts: 9
Reputation: sidereal is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sidereal sidereal is offline Offline
Newbie Poster

Re: any suggestions please-Runtime problem

  #2  
Apr 19th, 2006
post the code
Reply With Quote  
Join Date: Apr 2006
Posts: 4
Reputation: uth is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
uth uth is offline Offline
Newbie Poster

Re: any suggestions please-Runtime problem

  #3  
Apr 19th, 2006
Thanks. The following code is inside a function within a class. Now there is an application called triple used for inferencing. It is an exe but I am not able to invoke it directly. Thats why all the hassle. It consists of two parts.The first part as shown below calls "Commandline" which generates a file. Then when I call the xsbexec.bat, it takes the file thats generated and uses it to generate an output. That i'm redirecting to another file.
[inlinecode]
String[] args1 = new String[2];

args1[0] = "copyTriple.triple";
// "copyTriple.triple";
args1[1] = "Ignored arguments";
System.out.println("Calling commandline main");
Commandline.main(args1);
try {

Runtime rt = Runtime.getRuntime();
String[] args2 = { "xsbexec.bat" };
rt.exec(args2);
fout1.close(); p1.close();
boolean success = (new File("copyTriple.triple")).delete();
if (!success) {
System.out.println("copyTriple not deleted");
}
System.out.println("done");
}
catch (IOException ioe) {
System.out.println(ioe);
}
[\inlinecode]


The following is what the batch file contains:
@echo off

rem adapt paths here

set XSB=C:\XSB\config\x86-pc-windows\bin\xsb
rem end adapt


echo running %1 %2 %3 %4 %5 %6 %7 %8 %9
%XSB% --nobanner --quietload --noprompt -e "['C:\Documents and Settings\Uthru\workspace\Patient records\#out']." >xsbex2.out

echo done.

exit

Thanks a tonne!

Originally Posted by sidereal
post the code
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:30 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC