Jython 简明教程

Jython - NetBeans Plugin and Project

Python 和 Jython 对 NetBeans 的支持可通过 nbPython plugin 获得。从以下 URL 下载插件 - http://plugins.netbeans.org/plugin/56795 。将下载的压缩文件解压到某个文件夹中。例如 - d:\nbplugin 。要安装 NetBeans 插件,请按照以下步骤操作。

Step 1 - 启动 Netbeans IDE ,然后转到“工具/插件”以打开插件管理器。选择“已下载”标签并浏览到已解压下载文件中的文件夹。NetBeans 窗口将按如下所示显示。

netbeans ide

Step 2 - 下一步是选择所有 .nbm 文件并单击“打开”。

nbm

Step 3 - 单击“安装”按钮。

install button

Step 4 - 接受以下许可协议以继续。

agreement

忽略有关插件的来源不可信的警告,并重新启动 IDE 以继续。

Jython Project in NetBeans

重新启动后,通过选择“文件/新建”来启动一个新项目。现在,类别列表中将提供 Python 类别。选择它来继续。

category

如果系统已安装 Python,其版本/版本将被自动检测,并显示在 Python 平台下拉列表中。但是,Jython 不会被列出。单击管理按钮进行添加。

python

点击“新建”按钮添加 Jython 可执行文件中的平台名称和路径。

jython executable

Jython 现在可用于平台列表中。从下拉列表中选择,具体如以下屏幕截图所示。

dropdown list

我们现在可以在下一个窗口中填写项目名称、位置和主文件。

project name

项目结构将显示在 NetBeans IDE 的项目窗口中,编辑器窗口中将显示一个模板 Python 代码。

projects window
template python code

构建并执行 Jython 项目以在 NetBeans IDE 的输出窗口获得以下结果。

output window