Problem scenario
You are running a Groovy program.
Here is your code:
def input = System.console().readLine ‘Please provide some input: ‘
def x = input
def boardArray = new String[2]
boardArray[0] = “”
boardArray[1] = “”
boardArray[1] = $x //this is the incorrect version
println boardArray[1]
When you run it (i.e., with groovy foobar.groovy), you get this error:
Caught: groovy.lang.MissingPropertyException: No such property: $x for class:
groovy.lang.MissingPropertyException: No such property
What should you do?
…
Continue reading “How Do You Troubleshoot “groovy.lang.MissingPropertyException: No such property” when running a Groovy Program?”