What array? You haven't got any arrays.Hernan Blanco wrote: . . . an empty array.
Yes, you do; you are doing it correctly, with the Runtime.exec() method.I don't know how to create a new instance of Process . . ..
Campbell Ritchie wrote:Yes, you can use the == null test, but maybe != null would work better.
Joanne
Joanne Neal wrote:
Campbell Ritchie wrote:Yes, you can use the == null test, but maybe != null would work better.
My reading of the question was, whether, after adding a Process to the List, he could check if the process had completed by checking if the entry in the list was now null.
If I'm right, then the answer is no, because the Process instance will still exist even when the process it is running has completed.
Campbell Ritchie wrote:But why do you want a List<Process> or a Process[] array?
Hernan Blanco wrote:And my initial problem is still unsolved! when I run my program, the error message is: Exception: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
Hernan Blanco wrote:If you are thinking another way to do this, I will hear you!
Joanne
Hernan Blanco wrote:Now I know why I have this problem. It's beacause the MonProc.get(i) == null condition. I'm calling this method when I didn't add any element into my list. So, with i=4, the sentence is: (MonProc.get(4) == null), but in the list there isn't any element at position 4. How can I do to know if there's an element at the i position? I thougth it is with the get() method, but it give me an error.
Joanne
Hernan Blanco wrote:I know the maximum size of my list: 5
Hernan Blanco wrote:But my doubt is, when I remove an element from the list, the position keeps empty, or the elements get reordered?
Hernan Blanco wrote:And I remove the third position... the result is [1] [1] [0] [1] [1] or [1] [1] [1] [1] [0]
Joanne