Dear Astigmatic,

i hope my example can help you. i'm developing an interface between a COM application and Primavera API (which is Java). working on xp using eclipse with pydev.

i had problem making jar files with jython 2.2.x, as jythonc is not working anymore, but fortunately Greg wrote this nice article about distributing jython scripts.
i've created my solution too based on this article.

in the jython installation package there is an option to install Standalone jython. beside of the standard installation package i installed this option too in a different folder. in this folder there is only one jar file, containing all necessary jython module, which is existing in the standard installation folder.

i renamed this standalone jar to Scheduler_IF.jar. using Total Commander you can modify archives. so open the standalone jar file, and in the lib folder created a subfolder (schif) which contains all my jython scripts with __init__.py (to be a package).

then because my application requires third party jars too these needs to be copied also in the standalone jar file. e.g. i need to use java com bridge, for this purpose i've selected jacob, so i need to copy from the original jacob.jar com folder to the standalone jar com folder (jacob). the same needs to be done for the PV integration api jar file.
so after that in the Scheduler.jar/com i have jacob, primavera, and ziclix folders.

then i have a __run__.py file next to the Scheduler_IF.jar
import sys

from schif.schIFBase import Options
from schif.schIFMain import IfMain

if __name__ == '__main__':

    oOption = Options(['pvuser', 'pvpwd', 'pmsuser', 'pmspwd', 'xml', 'transfer'], {'log':'INFO'})
    oOption.parse()
    oOption.check()
    if oOption.oCheckError:
        print "Missing parameters: --%s" % ", --".join(oOption.oCheckError)
        sys.exit()
   
    oApp = IfMain(oOption)
    oApp.start()

these packages are in the Scheduler_IF.jar file:
from schif.schIFBase import Options
from schif.schIFMain import IfMain

and i have a start.bat, which starts the whole application.
@echo off
setlocal
set DIR_JAVA=C:\Program Files\Java\jdk1.5.0_12\
set ARGS=
:loop
if [%1] == [] goto rundemo
        set ARGS=%ARGS% %1
        shift
        goto loop

:rundemo
"%DIR_JAVA%bin\java.exe" -Xms1024M -Xmx1024M -XX:PermSize=256M -XX:MaxPermSize=256M -jar SchedulerIF.jar __run__.py %ARGS%


endlocal


as you can see it starts java exe with the Scheduler_IF.jar giving as first parameter the __run__.py, and the other parameters.

On Feb 2, 2008 4:50 AM, <astigmatik@gmail.com> wrote:
I've been struggling to create a jar file for something that I wrote.
So I started reading the wikis and whatnot.

>From http://wiki.python.org/jython/JythonFaq/DistributingJythonScripts
under the heading "Building jars - some examples", it says in the
second paragraph:

"The following example scripts were developed on Linux (and the bash
shell), but with minor modifications, you should be able to do the
same thing in an MS DOS box on MS Windows."

Alas, cp is non-existent in Windows, and zip command is also non-existent.

I also read http://wiki.python.org/jython/LearningJython but again, it
is not mainly for Windows users.

Can anyone point me to a tutorial on how to create jar files
specifically for non-java programmers and Windows users? My scripts
work perfectly btw if I run it from the MS DOS command line.

Regards,
astigmatik

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users



--
"De sagittis hungarorum libera nos, Domine!" - "A magyarok nyilaitól ments meg Uram minket!"

http://www.freeweb.hu/pillesoft