OK,

Here is the trick for Eclipse. I created a Java project with Jython.jar and Java run configuration. The main class to use is "org.python.util.jython" and the argument "src/file_to_run.py" (this is the path relative to the project). You can also use "org.python.util.JarRunner" and it will run "__run__.py" regardless of the argument if you prefer.

Then I can exported this project as a Runnable Jar with the Library Handling option set to "Extract related libraries into generated Jar".

Then I have to manually change the MANIFEST.MF file. I copied the file of the previous jar file I talked about in the previous message.

Finally, I can run it with "java -jar jar_name.jar -jar jar_name.jar".

You cannot specify the arguments in the manifest. You have to pass them on the command line.

I guess it would be nice to create an external tool in Eclipse to do an exportation that would not need manual manipulation. But otherwise, it works.

2011/4/19 Pierre Thibault <pierre.thibault1@gmail.com>
2011/4/18 Ian Stevens <i.stevens@syncapse.com>
Pierre, do you know what the other JAR bundling methods referenced in that Jython book are?



I've tried to put things in practice with Eclipse but I fail. Here is how I succeeded manually:

1) I made a copy of jython.jar under another name.
2) I opened the jar file with my compression tool (Ark).
3) I added at the root of the archive the Python file to run as "__run__.py". I only have one in this simple test.
4) I saved the new archive.
5) I used "java -jar jar_name.jar -jar jar_name.jar" to run the application.

The first "-jar jar_name.jar" is for running Jython and the second one is to tell Jython to run the .jar.

It was tricky. Is this a solution?

--



--


A+

-------------
Pierre
My blog and profile (http://pierrethibault.posterous.com)
YouTube page (http://www.youtube.com/user/tubetib)
Twitter (http://twitter.com/pierreth2)