can any one plz find the error.
Items are not added in ComboBox is the main problem.
here actually i'm adding items in combobox where the items are the output of the execution of script. i don't know y the items are not added in the combobox can u plz find out the problem....
and here is the code.
Code Java:
String line;
JComboBox combo=new JComboBox();
ProcessBuilder pb=new ProcessBuilder("./script.sh);
Process p=pb.start();
BufferedReader output=new BufferedReader(new InputStreamReader(p.getInputStream()));
while((line=output.readLine())!=null){
synchronized(this){
combo.addItem(line);
}
}
Re: can any one plz find the error.
This could be any number of things. Recommend you post an SSCCE which demonstrates the problem, otherwise its guessing
Re: can any one plz find the error.
It appears you're missing a " at the end of
ProcessBuilder pb=new ProcessBuilder("./script.sh);
Maybe that was just when you posted it online, but if not, that's probably your problem.
Also, if the items aren't being added, perhaps
Code java:
while((line=output.readLine())!=null){
synchronized(this){
combo.addItem(line);
}
is never being entered for some reason.