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
1
vote
1 answer

IntelliJ Delete Groovy Console When close

Everytime I want to run some simple Java/Groovy code in the Groovy Console, it saves a groovy file at my IntelliJ AppData directory (C:\Users\user\AppData\Roaming\JetBrains\IdeaIC2020.3\consoles\groovy\groovy_console_5.groovy): There is a easy way…
Victor Soares
  • 757
  • 1
  • 8
  • 34
1
vote
1 answer

Can I store a value from a table search in a variable?

I have this code: WebUI.openBrowser('') WebUI.navigateToUrl('https://www.texaslending.com/') WebUI.click(findTestObject('Page_TexasLending.com - When you think of m_ec7bcf/img_Simplify your search. Select your…
1
vote
1 answer

Executing scripts in groovyconsole with Java 11 generates missing JAXB dependency exception

I have seen other questions on this but the vast majority of answers specify setting dependencies POM.xml files i.e. for running groovy scripts in e.g. Intellij. I am simply trying to get groovyconsole (in windows) to execute a one line print…
JL_SO
  • 1,742
  • 1
  • 25
  • 38
1
vote
0 answers

"Error: could not find or load main class #" while opening groovy console

When I try to open groovyConsole.bat, I get the following error Error: Could not find or load main class # Tried the below to troubleshoot 1) Checked the env variable and gave the below java_home: C:\Program Files\Java\jdk1.8.0_221 Path:…
1
vote
1 answer

Groovy to fetch only specify file from various folders

I am running below groovy script to fetch dynamic values from aws s3 bucket. And below script is working fine and it will fetch all objects like shown in below output. current output is test-bucket-name/test/folde1/1.war …
Vinod HC
  • 1,557
  • 5
  • 20
  • 38
1
vote
1 answer

How to save output from groovyconsole in a file?

I have installed groovyconsole in AEM and have bunch of stuff that I would like to save in a file as output. Following this post, I tried: def filePath = "/content/corporate/reports/output.csv" File output = new File(filePath) output.append('Hello…
Buggy Coder
  • 383
  • 5
  • 17
1
vote
1 answer

How to change the font of GroovyConsole

I'm running GroovyConsole 2.4.13 on Windows 10. I want to change the font of the text area and of the output window. I can't find out how to do this. Can it be done? Wasn't it possible in a previous version? Did Apache take that feature away?
Jeff Pratt
  • 1,619
  • 1
  • 13
  • 21
1
vote
1 answer

Error while reading input xml and constructing output xml using groovy

I'm trying to extract values from input xml and construct output xml using groovy. I'm getting below error .I took a small example to verify the logic. def xml1 = """ IT
Venkat
  • 11
  • 1
1
vote
1 answer

How to use System.in.readLine() in Groovy?

I wrote a groovy script like this: print "Please enter your name:" def name=System.in.readLine() println "My name is : ${name}" But when I ran it ,I got an exception: Exception thrown groovy.lang.MissingMethodException: No signature of method:…
Julian20151006
  • 191
  • 6
  • 12
1
vote
1 answer

Why two equivalent property are not equal in Groovy

Please have a look at this simple code: String.metaClass { getA = {delegate <<= delegate} } assert 'a'.a == 'a'.a Result: Assertion failed: assert 'a'.a == 'a'.a | | | | false aa aa Why…
Axe
  • 45
  • 1
  • 4
1
vote
2 answers

for loop in groovy for string with concatenation

I have string like Color=Blue|Size=M|Style=simpleStyle and it need to be converted as like below by using groovy. Color Blue Size
Simbu
  • 766
  • 1
  • 12
  • 37
1
vote
1 answer

Error while executing shell commands from GroovyConsole

I downloaded apache-groovy-2.4.6 for windows and from the GroovyConsole when i try to execute "dir".execute(), I am getting java.io.IOException: Cannot run program "dir": CreateProcess error=2, The system cannot find the file specified Can you…
java_geek
  • 17,585
  • 30
  • 91
  • 113
1
vote
3 answers

How to increase available memory size in GroovyConsole?

I'm running scripts inside GroovyConsole 2.4.5 on Windows 7 64-bit and they are crashing due to out of memory error. Runtime.getRuntime().maxMemory() shows 247MB and my PC has 32GB RAM. What is the way to increase memory available for GroovyConsole…
Paul Jurczak
  • 7,008
  • 3
  • 47
  • 72
1
vote
1 answer

Accessing elements of a map when using a variable key in Groovy

I'm trying to replace some characters in a String From a map Case 1 ​map= ['O':'0', 'L':'1', 'Z':'2', 'E':'3'] "Hey".toUpperCase().toCharArray().each{ print map.get(it,it) } The result is HEY Case 2 : I dont use toCharArray()…
Nouaman Harti
  • 213
  • 2
  • 4
1
vote
2 answers

What is classpath for Groovy Console / jdbc driver prblem?

Such database code is OK in Java environment (without binded value 'c'), but in Groovy console can't properly use jdbc, with exception java.sql.SQLException: No suitable driver found for jdbc:sqlserver://localhost;databaseName= Driver class is…
Jacek Cz
  • 1,872
  • 1
  • 15
  • 22