Simple testing harness for the GSE. Enter script roots as arguments and then input script names to run them. @param urls an array of URLs @throws Exception if something goes wrong
(String[] urls)
| 348 | * @throws Exception if something goes wrong |
| 349 | */ |
| 350 | public static void main(String[] urls) throws Exception { |
| 351 | GroovyScriptEngine gse = new GroovyScriptEngine(urls); |
| 352 | BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); |
| 353 | String line; |
| 354 | while (true) { |
| 355 | System.out.print("groovy> "); |
| 356 | if ((line = br.readLine()) == null || "quit".equals(line)) { |
| 357 | break; |
| 358 | } |
| 359 | try { |
| 360 | System.out.println(gse.run(line, new Binding())); |
| 361 | } catch (Exception e) { |
| 362 | e.printStackTrace(); |
| 363 | } |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | /** |
| 368 | * Initialize a new GroovyClassLoader with a default or |