Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse "run as" missing groovy script

Tags:

eclipse

groovy

When I use eclipse to run a groovy file, the "run as" only shows two choices which are "Groovy Console" and "Java Application". It should has a "Groovy Script" as default but currently it does not.

To run the file, I have to use "run configurations" to choose the "Groovy Script". Are there any way that I could add "Groovy Script" back to the "run as" list?

like image 714
boubou planet Avatar asked Sep 09 '25 12:09

boubou planet


1 Answers

If you created your file in Eclipse using the "New" -> "Others" -> "Groovy Type" eclipse generated a class file. The class files cannot be executed as scripts even if they have the .groovy extension.

Try to create a completely new file with .groovy extension with the following content, as example:

println GroovySystem.version

Now the menu "Run as..." -> "Groovy script" is active. The content of your file must be script specific statements in order to get the "Groovy script" menu active.

like image 156
Cristian Chereji Avatar answered Sep 12 '25 01:09

Cristian Chereji