This was discussed here recently - read the archives.
 
The short answer is no, not without active participation from the script itself. You have to arrange for your script to periodically check some variable, and set that if you want to "interrupt" your script.
 
But some ideas for building such support into BeanShell were tossed around..


From: beanshell-users-admin@lists.sourceforge.net [mailto:beanshell-users-admin@lists.sourceforge.net] On Behalf Of MICHAEL PITONIAK
Sent: Friday, February 13, 2004 4:50 PM
To: beanshell-users@lists.sourceforge.net
Subject: [Beanshell-users] Stopping an interpterer that is sourcing a script?

Greetings,
 
 If a long script has been sourced from a file, is there a way to interrupt the interpreter and have it exit gracefully?
 
Thanks,
 
mike