Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: can any one plz find the error.

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default 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

  3. #3
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default 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

    while((line=output.readLine())!=null){
    synchronized(this){
    combo.addItem(line);
    }

    is never being entered for some reason.

Similar Threads

  1. Has to be a simple error, but I can't find it.
    By fride360 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 22nd, 2011, 10:15 AM
  2. Cannot find symbol error
    By AnuR in forum What's Wrong With My Code?
    Replies: 9
    Last Post: February 23rd, 2011, 02:50 PM
  3. Need help, cannot find error
    By Imeri0n in forum What's Wrong With My Code?
    Replies: 13
    Last Post: December 5th, 2010, 05:26 PM
  4. cannot find symbol Error
    By bananasplitkids in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 9th, 2010, 02:36 AM
  5. Replies: 2
    Last Post: November 3rd, 2009, 06:28 AM

Tags for this Thread