java and system calls
Hi everyone, every time I try to do a system call that has inside some variable e.g:
helloWorld6Today is a C compiled program, imagine I have one for each day of the month. String day=new String(); giveMeDay(day); --say it gives 6 Process egin=r.exec("/home/aizkorri/froga/helloWorld"+day+"Today"); egin.waitFor(); It just doesn't do anything, but If I do: Process egin1=r.exec("/home/aizkorri/froga/helloWorld6Today"); egin1.waitFor(); It works. And I think that it's pretty usual to use variables in that kind of calls, so do you have any idea what could be the problem?. |
Try putting spaces in the string and see if it works
Process egin=r.exec("/home/aizkorri/froga/helloWorld "+day+" " +Today); |
hi, well, but the file name doesn't have spaces, anyway, it doesn't even try to execute anything.
|
I see what you mean - I was reading it as two different parameters rather than one.
Only thing I can think of is giveMeDay is return a value you aren't expecting but I guess you've already checked that I take it in the first example egin.WaitFor() returns a non-zero value showing there's been an error and at least it's tried to execute it. |
thanks a lot, I found the error, it returns 1 but I forgot to put an important thing in the example: it does not work if I do:
Process egin=r.exec("/home/aizkorri/froga/helloWorld"+day+"*Today"); egin.waitFor(); Without the * it works fine, I was trying to execute more than one application at the same time but the * gives an error, I don't understand why, but it does. |
Quote:
|
thanks for the explanation
|
All times are GMT -5. The time now is 04:47 PM. |