Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

program doesn't terminate  RSS feed

 
Harish Kashyap
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i've written this much code in my program
public static void main(String[] arg)
{
Image img = Toolkit.getDefaultToolkit().getImage(arg[0]);
PixelGrabber p = new PixelGrabber(img,0,0,72,14,false);
try{
p.grabPixels(1000);
}catch(InterruptedException e){System.out.println("Interrupted thread :"+e);}
byte[] b = (byte[])p.getPixels();
System.out.println(b.length);
}

it runs perfectly prints the length of array but doesn't terminate untill i force it to.
can anybody tell me what's going wrong.
thanx
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've had problems with this too in programs that use AWT elements even though no GUI is displayed. I always have to force it to exit via System.exit( 0 )... I think it's probably because something in AWT assumes that you do not want to exit unless you explicitly state so... like in a normal GUI...

-Nate
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!