creating executable for jython scripts

后端 未结 2 781
伪装坚强ぢ
伪装坚强ぢ 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.

提交回复
热议问题