dcsimg
Problem: System call using Runtime.exec()
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Tuesday, November 21, 2006 10:57 PM

Hi! Could someone help me, please? I have a problem with this system calling Runtime.exec() . I wanna run Compiler GCC but I don't know if my code is correct (alright). see my code. Please help me, thanks. import java.io.BufferedReader; import java.io.InputStreamReader; import java.lang.Runtime; public class Compilor{ public Compilor(){ } public void Compila(String arqName) { Runtime r = Runtime.getRuntime(); System.out.println("Compilando "+ arqName + " aguarde..."); int lExitValue = -1 ; try { Process proc = r.exec("/usr/bin/gcc /home/andrep/"+arqName   More>>

Hi! Could someone help me, please?
I have a problem with this system calling Runtime.exec() .
I wanna run Compiler GCC but I don't know if my code is correct (alright). see my code.

Please help me,

thanks.



import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.Runtime;

public class Compilor{

public Compilor(){
}

public void Compila(String arqName) {

Runtime r = Runtime.getRuntime();
System.out.println("Compilando "+ arqName + " aguarde...");
int lExitValue = -1 ;

try {
Process proc = r.exec("/usr/bin/gcc /home/andrep/"+arqName);
BufferedReader stdout =
new BufferedReader(
new InputStreamReader(proc.getInputStream()));
BufferedReader stderr =
new BufferedReader(
new InputStreamReader(proc.getErrorStream()));

do {
if (stdout.ready())
System.out.println(stdout.readLine());
if (stderr.ready())
System.out.println(stderr.readLine());
try {
lExitValue = proc.exitValue();
}
catch (IllegalThreadStateException ex) {
// Process won't be ready.... a LOT
}
} while (lExitValue == -1);
}
catch(java.io.IOException e) {
System.out.println(e);
}
}
}

   <<Less

Re: Problem: System call using Runtime.exec()

Posted By:   Christopher_Koenigsberg  
Posted On:   Thursday, November 23, 2006 01:07 PM

and what is the "problem" that you have?
About | Sitemap | Contact