1

Groovy interpreter is built atop JVM. I made some Java libraries for JVM and some functions in the library will be called when running groovy scripts. Unfortunately, some error happens.

Therefore, I tried to launch groovy interpreter in the eclipse, so that I can set breakpoints in my code and debug the issue.

Therefore, what I have done is:

  1. First, I run the script in linux using groovy --indy ackermann.groovy 2 and then using ps to show the detail parameters. What I got is something like:

    /homes/sxu3/298182/bin/java -Xbootclasspath/p:/homes/sxu3/tools/jars/asmInliner-4.0.1.jar:/homes/sxu3/tools/jars/invoke.jar:/homes/sxu3/tools/jars/asm-all-5.0.3.jar:/homes/sxu3/tools/jars/common-4.0.1.jar:/homes/sxu3/tools/jars/logback-classic-1.1.3.jar:/homes/sxu3/tools/jars/logback-core-1.1.3.jar:/homes/sxu3/tools/jars/slf4j-api-1.7.7.jar:/homes/sxu3/tools/jars/conf/ -classpath /homes/sxu3/bin/groovy-2.4.8/lib/groovy-2.4.8.jar -Dscript.name=/homes/sxu3/bin/groovy-2.4.8/bin/groovy -Dprogram.name=groovy -Dgroovy.starter.conf=/homes/sxu3/bin/groovy-2.4.8/conf/groovy-starter.conf -Dgroovy.home=/homes/sxu3/bin/groovy-2.4.8 -Dtools.jar=/homes/sxu3/298182/lib/tools.jar org.codehaus.groovy.tools.GroovyStarter --main groovy.ui.GroovyMain --conf /homes/sxu3/bin/groovy-2.4.8/conf/groovy-starter.conf --classpath . --indy ackermann.groovy 2

  2. In eclipse, I create a run configuration > Java application > new. The main class is: org.codehaus.groovy.tools.GroovyStarter

and the VM Arguments:

-Dscript.name=Y:\bin\groovy-2.4.8\bin\groovy -Dprogram.name=groovy -Dgroovy.starter.conf=Y:\bin\groovy-2.4.8\conf\groovy-starter.conf -Dgroovy.home=y:\bin\groovy-2.4.8 -Dtools.jar=Y:\298182\lib\tools.jar --main groovy.ui.GroovyMain --conf Y:\bin\groovy-2.4.8\conf\groovy-starter.conf -classpath .   --indy

and the "Program Arguments": Y:\bin\indy-benchmark-suite_orig\programs\groovy\ackermann.groovy 300

This is shown as in the Screenshot

3 Add my libraries to the VM bootstrap and classpath.

After clicking the Run in the debug configuration, I got errors below:

JVMJ9VM007E Command-line option unrecognised: --main

The trick is at groovy's groovy.sh script, which launches a Java process. Therefore, I am looking whether some people can help solve it. Also how interpreter developers debug during development.

shijie xu
  • 1,975
  • 21
  • 52
  • Does this help? [How to debug Groovy code via the remote Java application debugging in Eclipse](http://stackoverflow.com/questions/9568957/how-to-debug-groovy-code-via-the-remote-java-application-debugging-in-eclipse) – Thomas Fritsch Feb 27 '17 at 21:49

0 Answers0