I am very interested in Python for programming on the JVM, and I've worked in Java and Ruby (not JRuby) a lot, and to a certain extent in Groovy.

What are the limits to the Java-Jython and Java-JRuby integration right now? What about Groovy: are there any things that a Java class can do that a Groovy class cannot? And what about IDE integration (mostly Eclipse, but IntelliJ and Netbeans are also interesting)?

I'm not interested in whether Python, Ruby or Groovy is better/more-concise/whatever. I'm just interested in how well they are working in the JVM and tools (especially IDEs) right now. My main interest is not inside a web server, if that matters.

Simple examples of getting a HelloWorld which extends a custom Java class and implements a custom Java interface would be very useful to me.

3 Answers 3


I have no experience of JRuby nor Groovy. But Jython:

  • Excellent integration with NetBeans. NetBeans can run Python programs with Jython almost straight out of the box, just install the "Jython Distribution" plugin and you're done. Apparently Eclipse works as well. See chapter Using Jython in an IDE in the Jython Book.

  • Java-Jython integration is excellent. Calling Java from Jython is super easy. Calling Jython from Java is not quite as straightforward (Java was not designed with Jython in mind), but still fairly easy. I've mostly had luck with creating a class in Jython (extending a Java class/interface), and then creating instances of that class in Java using an object factory. See Jython and Java Integration for how-to.

Extending a Java class in Jython works like this:

from javax.swing import JFrame, JButton

class MyFrame(JFrame):

    def __init__(self):
        self.defaultCloseOperation = JFrame.EXIT_ON_CLOSE
        self.size = (300, 300)
        self.add(JButton('Click Me!', actionPerformed=self.print_something))
        self.visible = True

    def print_something(self, event):
        print 'Clicked!'

Implementing interfaces works similarly, just import the interface, "extend" it using a class definition such as class MyClass(MyInterface) and implement what's needed.

My only criticism against Jython is that its raw performance is not very good (and that's mostly because it uses massive reflection to interact with Java). But then, raw performance is usually pretty irrelevant for a scripting language.

  • Great stuff +1. Any idea how Jython performance compares to Groovy's (also massively reflection-based) performance? Oct 22, 2010 at 7:01
  • I haven't personally compared them, but Google seems to find lots of opinions: www.google.com/#q=jython+vs+groovy+performance Oct 22, 2010 at 7:32
  • Google? Who's that? Looks like jython is worse than any of the other non-Java JVM langs. Interesting. Oct 22, 2010 at 15:05
  • People use Python for full-fledged desktop apps, so performance matters somewhat. Are you sure that Jython uses the Java reflection APIs. (Are you sure it hasn't adopted the techniques that Groovy and JRuby have? See blog.headius.com/2008/05/power-of-jvm.html and many other posts on the same blog for more discussion of performance.)
    – Ken Bloom
    Dec 16, 2010 at 14:32
  • @Ken Bloom: Yes, I wouldn't use Jython for full-fledged desktop apps, because it's quite slow (but I am using it embedded inside full-fledged Java apps). I'm quite sure that Jython uses mostly reflection APIs - unlike Groovy or JRuby, Jython's code base actually originates from the last millennium - although they may have made some optimizations lately. Thanks for the interesting blog link! Dec 16, 2010 at 14:49

For the last year, I've been working a lot with Groovy (and Java as well, but more Groovy).

IDE integration: OK in Netbeans. Since Groovy is dynamic, don't expect the same level of IDE support like Java (Intelisense, Refactoring etc.). Some people say that InteliJ is even better, but my coworker who checked it out didn't like it. YMMV. Last time I checked, support in Eclipse was not as good as in Netbeans.

Groovy can be very easily integrated or mixed with Java. The syntax is relatively similar, so the mental switch doesn't hurt too much.

Especialy when used with the Grails framework, Groovy is fun to work with (IMO). I also like the similarity to JavaScript; therefore a project that mixed Groovy on the backend with JavaScript on the client doesn't require understanding two completely different languages; in many cases, it feels more like two dialects of the same language.


Regarding Groovy, a Groovy class can certainly do everything that a Java class can, since valid Java is (almost) always valid Groovy.

I've found that Eclipse and NetBeans aren't quite ready for prime-time when it comes to Groovy/Grails development. But IntelliJ is really good, if you have the money.

  • Thanks for that. As I said in the question, I'm NOT interested in Web, so IntelliJ would be free. Oct 22, 2010 at 18:02
  • 1
    Java isn't quite ALWAYS valid Groovy (but almost), as detailed here (Though somewhat dated): stackoverflow.com/questions/687601/…
    – Northover
    Dec 16, 2010 at 9:32
  • added important qualifier. Dec 16, 2010 at 13:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.