Results 1 to 2 of 2
  1. #1
    shalini_cmc is offline Member
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Default 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.

    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);
    }
    }

  2. #2
    dswastik is offline Senior Member
    Join Date
    Dec 2008
    Location
    Kolkata
    Posts
    283
    Rep Power
    7

    Default

    Java Code:
    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){
    //does the line gets printed on the console?
    System.out.println(line);
    combo.addItem(line);
    }
    }
    Swastik

Similar Threads

  1. cant find the error , please help.
    By TheBreadCat in forum New To Java
    Replies: 13
    Last Post: 02-12-2011, 08:17 PM
  2. Exception error and I can't find the cause
    By Lish in forum New To Java
    Replies: 2
    Last Post: 01-31-2011, 10:53 AM
  3. Find the error in this and why this can't be ?
    By ron2794 in forum New To Java
    Replies: 11
    Last Post: 12-14-2010, 04:23 PM
  4. Can't find error in my program!
    By kkGG in forum New To Java
    Replies: 2
    Last Post: 11-10-2010, 06:38 PM
  5. I need help with an error! Cannot find symbol error!
    By ambria1975 in forum New To Java
    Replies: 2
    Last Post: 07-07-2010, 02:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •