Skillversitas

Jython in NetBeans

NetBeans can host Jython development through its Python support (the free PyDev-based "Python" module) or the older Jython integration, giving you Jython project templates, interpreter configuration, and debugging inside the IDE - a natural fit since NetBeans is Java-native and Jython projects are Java-plus-Python.

Enable Python Support

  1. Tools -> Plugins -> Available Plugins.
  2. Find and install the Python (PyDev) plugin - or the Jython plugin on older NetBeans releases.
  3. Restart NetBeans.

Create a Jython Project

  1. File -> New Project -> Python -> Python Application (or Jython, where offered).
  2. Name and location; choose the Python 2.7 flavor to match Jython.
  3. In the project properties, set the interpreter to your Jython installation.

Configure the Jython Interpreter

  1. Tools -> Options -> Python -> Python Interpreters.
  2. Add an interpreter pointing at the jython executable (jython.sh / jython.bat).
  3. NetBeans indexes the interpreter's site-packages plus your project's libraries for completion.

Adding Java Libraries

  1. Project Properties -> Libraries (or the project's classpath configuration).
  2. Add the jars your script imports (java.* from the JDK plus any third-party jars).
  3. The editor resolves those imports for completion and error marking.

Running and Debugging

  • Right-click the main .py -> Run File (or set a main class in Run Configuration) to execute with Jython.
  • Set breakpoints in the editor and use Debug -> Debug Project for step-through debugging with a variables and call stack view.
  • Console output (print statements, Java logging) appears in the IDE's output tab.

Why NetBeans for Jython

  • Java and Python projects side by side in one IDE - edit the Java jars' sources if you have them, then the Jython code that calls them.
  • Integrated refactoring for the Python side via PyDev, Java tooling for the rest.
  • Profiler and profiler-like tooling for JVM apps if you later move to pure Java.

Summary

Set up Jython in NetBeans by installing the Python/PyDev plugin, creating a Python 2.7 project, registering the Jython interpreter under Tools -> Options, and adding your jars to the project libraries. You then get completion for java.* imports, run configurations for jython, and breakpoints with a full debugger - a solid Java-plus-Python development environment.