Convert Jython scripts to .jar file

我的梦境 提交于 2019-12-11 09:48:44

问题


I have been trying to convert jython scripts to .jar file. I followed,

Distributing my Python scripts as JAR files with Jython?

The link above and also the Jython wiki link shown inside it use a command line script called, "zip". Its like => zip myapp.jar Lib

and so. I am on windows machine, so I couldn't find any script as "zip" on my command line, may be its a Linux script. Help me to do it in windows machine

Second is I have few external .jar's that are used in my jython scripts, for this the above link says to use manifest. But I want to package all external jars into single myapp.jar(for example) file to be running. Just like java -jar myapp.jar, so is there any way to package external jars also?

So please help me resolve this


回答1:


You can use jar command to add files to .jar archive. Just like:

jar uvf jythonlib.jar Lib

Use jar to see help with options and examples of usage.




回答2:


As you can see, the code zip -r jythonlib.jar Lib and zip myapp.jar Lib/showobjs.py, just add files to a jar archive. The zip program is a specific tool to do this, but it is not the only one. On windows, I would recommend using 7-zip to create the jar. Rather than zip -r jythonlib.jar Lib, open a new 7-zip window, create a new archive (zip protocol) called jythonlib.jar and add the folder called Lib which resides in $JYHTON_HOME. Then continue with the guide and when you get to zip myapp.jar Lib/showobjs.py, simply drag and drop the file called showobjs.py into the existing 7-zip window. This should add the file to the archive.



来源:https://stackoverflow.com/questions/15386777/convert-jython-scripts-to-jar-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!