现实世界的 Jython 应用程序

发布于 2024-09-16 17:57:39 字数 122 浏览 3 评论 0原文

我最近开始学习Python。尚未涉足编码领域。 在一次学习课程中,我遇到了 Jython 一词。

我用谷歌搜索了它&得到了一些信息。

我想知道是否有人使用 Jython 实现过任何实际程序。

I recently started learning Python. Not yet ventured into coding.
During one of my learning sessions, i came accross the term Jython.

I googled it & got some information.

I would like to know if anyone has implemented any real-world program using Jython.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

青衫儰鉨ミ守葔 2024-09-23 17:57:39

大多数时候,Jython 并不直接用于编写完整的读取世界程序,但许多程序实际上嵌入了 Jython 以将其用作脚本语言。

Jython 官方网站提供了项目列表,其中一些是用 Jython 编写的,另一些则使用 Jython 进行脚本编写:
http://wiki.python.org/jython/JythonUsers

Most of the time, Jython isn't used directly to write full read-world programs, but a lot of programs actually embed Jython to use it as a scripting language.

The official Jython website gives a list of projects, some written in Jython, others using Jython for scripting:
http://wiki.python.org/jython/JythonUsers

寄居者 2024-09-23 17:57:39

我目前正在 Jython 中编写完整的应用程序,并且强烈推荐它。拥有所有可供您使用的 Java 库非常方便,而且 Python 语法和语言功能实际上使使用其中一些库比在 Java 中更容易(我在这里主要谈论 Swing)。

查看Jython 书中有关 GUI 应用程序的章节。它进行了很多比较,例如“看看所有这些 Java 代码,现在看看它缩减为长度一半的 Python 代码!”。

我发现的唯一警告是:

  • Jython 开发的运行速度往往稍微落后于 Python,如果您找到了一种很酷的 Python 执行方式,但却发现当前的 Jython 版本不支持它,这可能会很烦人。
  • 有时,您可能会遇到 Python 和 Java 之间的接口问题(我有几个未解决的问题此处这里,尽管这种事情总是有解决方法)。
  • 分发并不像想象的那么简单,尽管一旦你弄清楚如何做到这一点,它就相当轻松。我建议遵循此处的方法。它主要包括:
    1. 分解 jython.jar 并向其中添加您自己的模块。
    2. 编写并编译一个小型 Java 类,用于创建 Python 解释器并加载 Python 模块。
    3. 创建一个包含 jython.jar 模块、您自己的 Python 模块和 Java 类的可执行 .jar 文件。

I am writing a full application in Jython at the moment, and would highly recommend it. Having all of the Java libraries at your disposal is very handy, and the Python syntax and language features actually make using some of them easier than it is in Java (I'm mostly talking about Swing here).

Check out the chapter on GUI Applications from the Jython book. It does a lot of comparisons like 'Look at all this Java code, and now look at it reduced to Python code of half the length!'.

The only caveats I've found are:

  • Jython development tends to run slightly behind Python, which can be annoying if you find a cool way of doing something in Python, only to discover it's not supported in the current Jython version.
  • Occasionally you might have hiccups with the interface between Python and Java (I have a couple of unsolved problems here and here, although there are always workarounds for this kind of thing).
  • Distribution is not as simple as it could be, although once you figure out how to do it, it's fairly painless. I recommend following the method here. It essentially consists of:
    1. Exploding jython.jar and adding your own modules into it.
    2. Writing and compiling a small Java class that creates a Python interpreter and loads up your Python modules.
    3. Creating an executable .jar file consisting of the jython.jar modules, your own Python modules, and the Java class.
〆一缕阳光ご 2024-09-23 17:57:39

Jython 在依赖注入方面确实很出色。

您知道必须为程序提供的那些讨厌的变量,例如

  • 文件系统路径
  • 服务器名称
  • 端口

Jython 提供了一种通过将这些变量放入脚本中来注入这些变量的非常好的方法。它对于注入 java 依赖项也同样有效。

Jython really shines for dependency injection.

You know those pesky variables you have to give your program, like

  • file system paths
  • server names
  • ports

Jython provides a really nice way of injecting those variables by putting them in a script. It works equally well for injecting java dependencies, as well.

陌路黄昏 2024-09-23 17:57:39

WebSphere 和 WebLogic 将其用作默认脚本引擎以实现管理目的。

许多其他 Oracle 产品将其作为“oracle_commons”模块(Oracle Universal Installer、Oracle HTTP Server 等)的一部分提供。不过,目前部署的主要是 2.2 版本,该版本有点陈旧且笨重。

WebSphere and WebLogic use it as their default scripting engine for administrative purposes.

A lot of other Oracle products ship it as part of their "oracle_commons" module (Oracle Universal Installer, Oracle HTTP Server etc). It's mostly version 2.2 being deployed though, which is a bit old and clunky.

毁我热情 2024-09-23 17:57:39

有一个使用 jython 的应用程序列表 http://wiki.python.org/jython/JythonUsers< /a>

There is a list of application that uses jython at http://wiki.python.org/jython/JythonUsers

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文