Jython – NetBeans Plugin and Project

Python and Jython support for NetBeans is available via the nbPython plugin. Download the plugin from following URL – http://plugins.netbeans.org/plugin/56795. Unzip the downloaded archive in some folder. For example – d:\nbplugin. To install the NetBeans Plugin, let us follow the steps given below.

Step 1 − Start the Netbeans IDE and then go to Tools/Plugin to open the Plugin Manager. Choose ‘Downloaded’ tab and browse to the folder in which the downloaded file has been unzipped. The NetBeans window will appear as shown below.

Netbeans IDE

Step 2 − The next step is to select all the .nbm files and click open.

nbm

Step 3 − Click on the Install button.

Install Button

Step 4 − Accept the following license agreement to continue.

Agreement

Ignore the warning about untrusted source of plugins and restart the IDE to proceed.

Jython Project in NetBeans

Once restarted, start a new project by choosing File/New. Python category will now be available in the categories list. Choose it to proceed.

Category

If the system has Python installed, its version/versions will be automatically detected and shown in the Python platform dropdown list. However, Jython will not be listed. Click on the Manage button to add it.

Python

Click on the ‘New’ button to add a platform name and path to Jython executable.

Jython Executable

Jython will now be available in the platform list. Select from the dropdown list as shown in the following screenshot.

Dropdown List

We can now fill in the project name, location and main file in the next window.

Project Name

The project structure will appear in the projects window of the NetBeans IDE and a template Python code in the editor window.

Projects Window

Template Python Code

Build and execute the Jython project to obtain the following result in the output window of the NetBeans IDE.

Output Window