Calling Scala from Groovy Add comment to Wiki View in Wiki Edit Wiki page Printable Version

First write a Scala class:

Complex.scala

Compile this using scalac:

Now write our Groovy Program:

ComplexMain.groovy

Now run the program (assuming scala-library.jar is in the CLASSPATH):

Which produces:

1.2+3.4i

Note that in this example it would have been just as easy to write our Complex class using Groovy as follows:

but in other cases you may have some existing Scala classes you wish to reuse from Groovy.

 

Search

Results of your search request can come from various sources: the Groovy website itself, the JIRA issues, the API documentation, as well as a few other interesting Groovy-related blogs.

  By  -  pages  -  views  - last modified