Sundararajan's Weblog

  • Java
    January 29, 2016

Accessing Python objects from Nashorn JavaScript

Dynamic linker API for the Java platform (JEP 276) in JDK 9 Early Access defines dynamic linker API for the Java platform. Using this API, different language runtimes implemented for the Java platform can interoperate with each other.

Nashorn JavaScript engine has been a part of JDK platform since JDK 8. Jython is an implementation of the Python programming language designed to run on the Java platform. In this blog entry, I'll demonstrate
seamless access of Python objects from a Nashorn script!


My directory structure looks as follows:

With the above files in place, we just to have run the sample with this command:

jjs jython_linker.js

The output looks as follows:

With Dynalink, different language runtimes can interoperate with each other! Have fun with mixed language programming on the Java platform!

Join the discussion

Comments ( 1 )
  • kalkulator macierzy obliczone Thursday, February 4, 2016

    Very helpful article, I like especially a step by step presentation. Thank You very much.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.