Hi All,

i am again stuck with the same problem. I need to run an executable which i got from University of Edinburgh. I have to pass various parameters to it as follows:-

File to run (Executable) :/home/nakul/moses/mosesdecoder/trunk/moses-cmd/src/moses

The parameters:"-f /home/nakul/moses/mosesdecoder/trunk/scripts/training/moses-scripts/scripts-20110405-1055/training/corpus/tuning/mert/moses.ini","-v","2".

The output and the intermediate steps(like loading of other files etc.) of this executable (moses), i want them in a textfield/TextArea.

When i run this executable from outside the application, i get following results and intermediate calls.

Command:-echo " what is the main obstacle in your work ?"| TMP=/tmp /home/nakul/moses/mosesdecoder/trunk/moses-cmd/src/moses -f /home/nakul/moses/mosesdecoder/trunk/scripts/training/moses-scripts/scripts-20110405-1055/training/mert/moses.ini

the intermediate and final results after executing this command are as follows:-

Defined parameters (per moses.ini or switch):
config: /home/nakul/moses/mosesdecoder/trunk/scripts/training/moses-scripts/scripts-20110405-1055/training/mert/moses.ini
distortion-file: 0-0 wbe-msd-bidirectional-fe-allff 6 /home/nakul/moses/mosesdecoder/trunk/scripts/training/moses-scripts/scripts-20110405-1055/training/model/reordering-table.wbe-msd-bidirectional-fe.gz
distortion-limit: 6
input-factors: 0
lmodel-file: 0 0 3 /home/nakul/moses/mosesdecoder/trunk/scripts/training/moses-scripts/scripts-20110405-1055/training/hindi_lm5.lm
mapping: 0 T 0
ttable-file: 0 0 0 5 /home/nakul/moses/mosesdecoder/trunk/scripts/training/moses-scripts/scripts-20110405-1055/training/model/phrase-table.gz
ttable-limit: 20
v: 0
weight-d: 0.000181 0.001952 0.001871 0.000044 0.000035 -0.001831 0.001144
weight-l: 0.006173
weight-t: 0.000006 0.015365 0.159487 0.000179 -0.757147
weight-w: -0.054585
Loading lexical distortion models...have 1 models
Creating lexical reordering...
weights: 0.002 0.002 0.000 0.000 -0.002 0.001
Loading table into memory...done.
Start loading LanguageModel /home/nakul/moses/mosesdecoder/trunk/scripts/training/moses-scripts/scripts-20110405-1055/training/hindi_lm5.lm : [4.000] seconds
/home/nakul/moses/mosesdecoder/trunk/scripts/training/moses-scripts/scripts-20110405-1055/training/hindi_lm5.lm: line 417: warning: non-zero probability for <unk> in closed-vocabulary LM
Finished loading LanguageModels : [4.000] seconds
Start loading PhraseTable /home/nakul/moses/mosesdecoder/trunk/scripts/training/moses-scripts/scripts-20110405-1055/training/model/phrase-table.gz : [4.000] seconds
filePath: /home/nakul/moses/mosesdecoder/trunk/scripts/training/moses-scripts/scripts-20110405-1055/training/model/phrase-table.gz
Finished loading phrase tables : [13.000] seconds
IO from STDOUT/STDIN
Created input-output object : [13.000] seconds
Translating: what is the main obstacle in your work ?

Collecting options took 0.000 seconds
Search took 0.200 seconds
BEST TRANSLATION: क्या तुम्हारे obstacle|UNK|UNK|UNK काम मुख्य ? [111111111] [total=-104.119] <<-16.000, -6.000, -100.000, -1.609, 0.000, -3.530, 0.000, -1.946, -5.590, -43.510, -10.792, -14.615, -0.992, -5.737, 4.999>>
क्या तुम्हारे obstacle काम मुख्य ?
Translation took 0.200 seconds
Finished translating
End. : [13.000] seconds

So i want all the result mentioned above to be placed within a TextArea

for this i have put following code in a java file:-
   private void jButton1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MousePressed 
        // TODO add your handling code here: 
        Process p1,p2,p3; 
        String s=null,s2=null,kk=null,s1[]; 
        s=jTextField1.getText(); 
        System.out.println(s); 
        jTextArea1.append("Input String is::"); 
        //jTextArea1.append(s); 
 
 
        try 
        { 
        String[] args = { "cat", System.getenv("HOME") + "/hindi.txt" }; 
            //String[] args = { "cat", "~/hindi.txt" }; 
        Process p = Runtime.getRuntime().exec(args); 
        InputStream o = p.getInputStream(); 
 
 
 
        byte[] bytes = new byte[4096]; 
        for (;;) 
        { 
            int nread = o.read(bytes); 
            if (nread == -1) break; 
 
            jTextArea1.append(new String(bytes, 0, nread)); 
        } 
 
        jTextArea1.append("Source Sentences are :"); 
        jTextArea1.append(null); 
 
 
        jTextArea1.append(jTextField1.getText()); 
        jTextArea1.append(null); 
 
        jTextArea1.append("Calling Moses Decoder...\n\n"); 
 
        String [] arg1={"echo","$s", "|TMP=/tmp","/home/nakul/moses/mosesdecoder/trunk/moses-cmd/src/moses","-f /home/nakul/moses/mosesdecoder/trunk/scripts/training/moses-scripts/scripts-20110405-1055/training/corpus/tuning/mert/moses.ini","-v","2"}; 
 
        System.out.println(s); 
        Process pro2=Runtime.getRuntime().exec(arg1); 
        InputStream o1=pro2.getInputStream(); 
        byte[] bytes1 = new byte[4096]; 
        for (;;) 
        { 
            int nread = o.read(bytes1); 
            if (nread == -1) break; 
 
            jTextArea1.append(new String(bytes1, 0, nread)); 
        } 
 
        }catch(Exception e){ 
 
            System.out.println(e); 
        } 
 
    }


Please tell how to solve this problem ? i have tried several solutions but to no avail.