Opening a File into the GroovyConsole programmatically

Groovy 1.6 (still in beta) has introduced a new handy method into the Groovy Console : loadScriptFile. That allows you to load a script and open it into the Groovy Console. Here are the few lines of code to make it work.

import groovy.ui.Console;

Console console = new Console();
console.run();
console.loadScriptFile("C:/My documents/MyScript.groovy");

That‘s it.

Categories: Groovy

Tagged as:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s