Chakradhar K
Chakradhar K

Reputation: 509

Convert Jython scripts to .jar file

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

Upvotes: 1

Views: 1480

Answers (2)

Michał Niklas
Michał Niklas

Reputation: 54292

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.

Upvotes: 1

charmoniumQ
charmoniumQ

Reputation: 5513

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.

Upvotes: 0

Related Questions