Netbeans Python IDE features: Compiling and Running Jython Projects and Shortcuts

Tuesday, February 17, 2009

In my previous post, we looked at Netbeans IDE for CPython, Configuring and Running CPython Projects and IDE shortcuts, for the sake of completeness, in this article, we will look into Configuring and Running Jython (JPython) projects from Netbeans, though both are similar languages with different implementations, I wanted to explore how jython features would work in Netbeans, especially the IDE features and configuration for java class libraries accessible from jython.

For those of you who want to follow this article series from the beginning, I recommend you to look at my introduction on Netbeans IDE for Python and Jython, the basic introduction would help you to create a Python project, configure platform settings for projects, etc.

Netbeans Python IDE would be the first integrated IDE for CPython as well as JPython and we will see the following JPython IDE features in this section.

1. Jython Platform settings and running the interactive jython console
2. Jython Library Settings
3. Autocompletion features for jython modules, built in functions and java class libraries
4. Running Jython projects and modules, configuring command line options
5. Important IDE Shortcuts

1. Jython Platform settings and running the interactive jython console

Now you have an active Jython project, the first thing which you must always do is to change the platform settings to jython for the interactive python console as well as for compiling/running the jython project (if you had created a new jython project, you would have configured the compilation/run time platform to jython already).

The good thing is Jython 2.5 is bundled with Netbeans IDE, so it is the default platform for Interactive Python Interpreter, in any case from Netbeans IDE, click Tools -> Python Platforms -> Select Jython (2.5 in this example), and click "Make Default" button if its not the default platform configured already, see the figure below.

Fig 1: Jython Platform Settings

Also you can change the project property settings to change the platform to jython as shown in the figure below (Project Properties -> Python -> Python Platform).

Fig 2: Changing Python Platform settings through Project Properties

From the Netbeans python IDE, you can run the interactive jython console (this is available on all jython installations, the one you will get when you invoke jython without arguments), to start jython interactive console, all you need to do is to invoke Window -> PythonConsole as shown in the figure below, make sure that the platform shown is java when the console starts, you should then be able to import jython/java class libraries and access their methods.

Fig 3: Jython Interactive Console

2. Jython Library Settings

Jython has core/third party python libraries which run on JVM as well as java class libraries, therefore if you need to add your own python libraries to the project, you can add them through Tools -> Python Platforms -> Python Path -> Add -> Library Path and java libraries through Tools -> Python Platforms -> Java Path -> Add -> Library Path (or jar file locations).


Fig 4: Jython Library Path Settings

3. AutoCompletion features for jython modules, built in functions and java class libraries

Though this is similar to the one we explored for CPython libraries and built in functions, the autocompletion feature doesn't work as I expected for java class libraries, but I am sure that if standard python built in functions like dir() works for java class libraries, this feature may also work in future versions (will update it by then).

1 comment:

Anonymous said...

Many thanks for this !


Copyright © 2016 Prasanna Seshadri, www.prasannatech.net, All Rights Reserved.
No part of the content or this site may be reproduced without prior written permission of the author.