Hello can anyone help me out. I am making a program that will auto log me in and do some other things once logged in.. the problem is my code for loggin in..

The login requires you to pass a captcha image. Soo what i tried to do is have it auto login and before it submits the info it would give me a pop up with the captcha image let me type it in and click ok , then it would apply that to the capatcha field on the site..

Everything works except when i get the pop up i dont get an image.. I am sure this code can be easilly fixed, I am not a good programmer for java but here is my code if you can help i would apprate it..
thanks
squills

Code:
/*
Takes the session variable CAPTCHA_URL, generates a user input window, then saves the output to CAPTCHA_TEXT.
*/

import javax.swing.JOptionPane;

cfile = "captcha_image_" + System.currentTimeMillis();
session.log( "CAPTCHA_URL: " + session.getVariable("CAPTCHA_URL") );
session.log( "CAPTCHA image file: " + cfile );
session.downloadFile( session.getVariable(  "CAPTCHA_URL" ), cfile );

imageIcon = new ImageIcon( cfile );

// Prompt the user for the text in the image.
response = JOptionPane.showInputDialog
(
null,
"Enter the text in the image",
"CAPTCHA Image",
JOptionPane.QUESTION_MESSAGE,
imageIcon,
null,
null
);
session.log( "User response: " + response );
session.setVariable( "CAPTCHA_TEXT", response );

imageIcon = null;

// Delete the image, now that we no longer need it.
new File( cfile ).delete();

System.gc();