title: How do I evaluate a Groovy string within a script?
body: <p>I'm essentially trying to create a CLI with Groovy. I have a whole JavaFX GUI set up in Java and I want to be able to type in groovy script to run different functions inside a groovy script.</p>
  
  <p>For example, say I have this script:</p>
  
  <pre><code>void meow() {
      println "walrus"
  }
  </code></pre>
  
  <p>I want to be able to type in "meow();" and press enter and evaluate it using the script as a reference.</p>
  
  <p>I've tried using</p>
  
  <pre><code>shell.evaluate(inputStr, "src/Server/Scripting/CommandLineScript.groovy");
  </code></pre>
  
  <p>but to no avail; it just comes up with the error:</p>
  
  <pre><code>groovy.lang.MissingMethodException: No signature of method: CommandLineScript.meow() is applicable for argument types: () values: []
  </code></pre>
  
  <p>I can call other standard functions, such as:</p>
  
  <pre><code>shell.evaluate("println 'Hello World!';");
  </code></pre>
  
  <p>but I just can't run my own methods... How to solve it?</p>