Questions tagged [groovy-console]

The Groovy Console is a Java Swing based graphical user interface that is packaged with the Groovy distribution. It provides a simple but elegant way of executing interactive groovy scripts, with Groovy script entered in the top window, and the output of the script appearing in the lower window.

The Groovy Console is a Java Swing based graphical user interface that is packaged with the Groovy distribution. It provides a simple but elegant way of executing interactive groovy scripts, with Groovy script entered in the top window, and the output of the script appearing in the lower window.

The console is launched with one of a few variations of a command line call to groovyConsole. The variations comprise platform differences and executables that are compiled for some operating systems. It's location is:

<Groovy Home>\bin\groovyConsole[.*]

Variations include:

  • groovyConsole.bat (Windows)
  • groovyConsole.exe (Windows)
  • groovyConsole (Unix/Linux)

Groovy Console Snapshot

enter image description here

GroovyConsole Functions

Some of the useful functions provided in the UI are:

  • File Open / File Save / File New
  • New Window (multiple open windows supported)
  • Standard Edit Menu Functions (Copy/Paste/Undo/Redo/Search/Replace)
  • Various UI Property Toggles and Controls
  • Groovy AST Viewer
  • Groovy Variables Viewer
  • Compile Scripts
  • Run Scripts
  • Interrupt Running Script
  • Add JAR to Classpath
  • Add Directory to Classpath
162 questions
3
votes
2 answers

Groovy unable to resolve class but works in groovyconsole

Trying to import the gpars withPool method into my project. The import works in groovyconsole but not when building in gradle. Both groovyconsole and gradle are running groovy version 2.4.5 Any ideas? Groovy Console import static…
Richard Todd
  • 2,406
  • 5
  • 32
  • 40
3
votes
2 answers

How to launch groovy console during runtime of a java program

I want to launch groovy console during runtime of my java program and Groovy Console should be able to access some java variables ex. int x = 5 ;// a variable in java program launchGroovyConsole(); // hypothetical method to launch groovy…
virendra chaudhary
  • 179
  • 1
  • 2
  • 18
3
votes
1 answer

Groovy JsonBuilder strange behavior when toString()

I need to create a json to use as body in an http.request. I'm able to build dynamically up the json, but I noticed a strange behavior when calling builder.toString() twice. The resulting json was totally different. I'm likely to think this is…
Mesi Rendón
  • 851
  • 1
  • 9
  • 21
3
votes
1 answer

groovyConsole throws java.lang.reflect.InvocationTargetException when starting

I had just installed groovy in Ubuntu Studio 12.10, from the Ubuntu's Software center, and I'm trying to run the GroovyConsole, but when I execute "groovyConsole" it throws an exception: java.lang.reflect.InvocationTargetException at…
gamerkore
  • 1,105
  • 1
  • 11
  • 16
3
votes
1 answer

difference between "grails console" and "grails", then "console"

I just started learning Grails and I'm trying to play around with the database using the grails console, but I notice that there's a difference between running grails console and running grails, then console: When launching grails console straight…
I'm a frog dragon
  • 7,865
  • 7
  • 46
  • 49
2
votes
2 answers

with Groovy Console, is it possible to reload changed files in classpath?

I often want to test methods I'm developing in a Groovy class independently, and use the Console to do so, like: groovyConsole -cp mygroovyfiles However I have not yet been able to figure out how to reload changes to my groovy files so that I can…
Josh Diehl
  • 2,913
  • 2
  • 31
  • 43
2
votes
1 answer

GroovyConsole ActiveMQ error: NoClassDefFoundError: Could not initialize class org.apache.activemq.ActiveMQPrefetchPolicy

I am trying to run a very simple ActiveMQ client script in GroovyConsole. I've included activemq-all-5.5.0.jar and slf4j-api-1.5.11.jar through the Script > Add Jar to ClassPath menu. I see org.apache.activemq.ActiveMQPrefetchPolicy in the…
leeatintel
  • 31
  • 1
  • 3
2
votes
1 answer

How to get service in aem groovy console?

I need to create a Java service, and the to ask that service from aem groovy console. I have created a service as Java class, built and deployed to local aem instance, and when I am trying to ask it with getService function, it's not working, and I…
Main Star
  • 53
  • 6
2
votes
2 answers

Splitting a string using a delimiter in Groovy and avoiding IndexOutOfBoundsException

I want to split an input parameter inputDetails to unit level. I'm using tokenize for doing this. Here is my code: Groovy Code: def inputDetails = "1234-a0-12;1111-b0-34"; def cDesc = inputDetails.tokenize(";"); for (int i=0; i
Yash
  • 2,944
  • 7
  • 25
  • 43
2
votes
4 answers

Lightweight console/IDE for Python?

I often use ipython (or the regular python shell) to test python code snippets while coding, and it's been very useful. One shortcoming of this, though, is that if I want to test a multi-line segment of code, or want to write multiple lines of code…
mindthief
  • 12,755
  • 14
  • 57
  • 61
2
votes
1 answer

error: invalid string constant "murrine-scrollbar", expected valid string constant while running groovy console with Java9

I was playing with DMelt 2.1 in http://jwork.org/dmelt/ and I've noticed I cannot start the Groovy console when using JDK9 (On Ubuntu 17.08, x64, JDK build 9.0.1+11). Then I noticed that JDK9 throws a lot of warnings even when using the original…
user7975996
  • 109
  • 1
  • 6
2
votes
1 answer

Unable to get Groovy extension module to work

I am trying to create an extension module and then use it in a different project/script but unable to get it to work. Here is what I am doing: Step-1: Created a file named TemperatureUtils.groovy which is a category-like class. Here is the…
2
votes
2 answers

@Grab not working in intellij IDE for groovy

I am pretty new to groovy , ans was practicing to make a REST call using the http-builder package , I am trying to add the dependency using a @Grab annotation , but it doesn't download the dependencies , the annotation is not working , My Code :…
2
votes
0 answers

Unable to create or search index using groovy

I'm using below method to check and create elasticsearch index. This script works perfectly for Elasticsearch 2.3 and 2.4 versions. I'm trying things with Elasticsearch version 5.0 but it isn't working. All i'm trying is to create an index and…
syndy1989
  • 403
  • 10
  • 25
2
votes
1 answer

Updating JSON Data with Groovy's HTTP Builder using PUT

I have requirement of updating Zendesk Tickets using Groovy HTTP Builder. I use the following code @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.0-RC2' ) import java.util.Properties; import…
Shashank Cool
  • 91
  • 2
  • 11
1
2
3
10 11