Just guess, but it looks like you are using Robotin the same thread as when starting up JFileChooser. If memory is used, many JFileChooser methods block the current thread until the user selects a file.
Try running Robotin a separate thread if you haven't already.
EDIT:
For instance:
new Thread(new Runnable() {
@Override
public void run() {
Robot robot = new Robot();
robot.delay(1000);
robot.keyPress(KeyEvent.VK_ESCAPE);
}
}).start();
jFileChooser.getSelectedFile();
source
share