creating executable for jython scripts

后端 未结 2 758
伪装坚强ぢ
伪装坚强ぢ 2021-01-13 13:38

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

相关标签:
2条回答
  • 2021-01-13 14:09

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

    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.

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

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

    You can download the skeleton for achieving this from here.

    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.

    0 讨论(0)
  • 2021-01-13 14:29

    Have you tried jump? It's a build tool for distributing Java and Jython applications. I have used it a few times before and it might be able to do what you need. It can

    Distributing Jython applications into a single, independent JAR file.

    Distributing Jython libraries into a single JAR file. [New in v0.9.5]

    Distributing native Mac OS X application bundles, Windows .exe executables, WAR files for

    Python WSGI applications. [New in v0.9.5]

    Distributing Java Only applications. [New in v0.9.6]

    Creating build.xml file for ant. [New in v0.9.7]

    Supporting Java source code and third-party JAR files.

    Supporting Java Native Interface files for distributing JAR files. [New in v0.9.5]

    Starting the created distribution from either Jython or Java code.

    Including specified resource files in the final distribution. [New in v0.9.6]

    Packaging only required Python packages into the final distribution automatically, which means you don't have to worry about using Python third-party libraries as long as they can be found in your sys.path.

    Importing specified Python packages explicitly. [New in v0.9.5]

    All Python modules included in the final distribution are compiled to $py.class files, which means your source code is not public.

    Integrated easy use Jython factory. [New in v0.9.7]

    0 讨论(0)
提交回复
热议问题