为jython脚本创建可执行文件 [英] creating executable for jython scripts

查看:193
本文介绍了为jython脚本创建可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于python脚本,我使用 py2exe 来创建可执行文件。有没有办法为jython脚本创建 .exe .jar 文件?

for python scripts i was using py2exe to create executable file. Is there any way to create either .exe or .jar file for jython script?

推荐答案

分享我如何实现这一目标。感谢EnigmaCurry提供框架。

Sharing how I achieve this. Thanks to EnigmaCurry for providing the framework.

来自Jython wiki的Jar方法效果很好。它的一个缺点是需要将所有Java依赖项扩展到主jar根目录中。这很快变得混乱。

Jar Method from Jython wiki works quite well. The one drawback that it has is that all of the Java dependancies need to be exploded into the main jar root. This gets messy very quickly.

因此该方法使用 One-Jar 。它是一个特殊的类加载器,可以加载jar文件中包含的jar。

So the approach uses One-Jar. It is a special class loader which can load a jar from contained in the jar file.

所以你可以把你的脚本/类,jython和其他库都打包成一个jar。

So you can have your script/class, jython and other libraries all getting packaged as a single jar.

您可以从此处

一旦你把它的脚本放在src中,把其他的jar(包括jython jar)放在lib文件夹中,把one-jar源放在各自的文件夹中使用
build.xml运行ant工具。

Once you get it put your scripts in src, put the other jars (including jython jar) in the lib folder, put one-jar source in its respective folder and just run the ant tool with build.xml provided.

然后你会得到你的罐子。

You will get your jar then.

这篇关于为jython脚本创建可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆