From: Garcia, M. <mg...@Bu...> - 2001-04-03 14:31:04
|
Hi Pierre, I believe you are correct. You must have the jython.jar on your delivery platform. This is not unlike trying to write servlets or some other java app. You need to have the supporting libs on the system it will run on. The jython app you are delivering is dependent on the jython distribution. Would it be possible to distribute jython with you jar? regards, Mick -----Original Message----- From: DITTGEN Pierre To: jyt...@li... Sent: 3/30/01 7:26 AM Subject: [Jython-users] Generated java classes dependency Hello, I'm quite new to jython, i find it very powerful as a script language. But at this time, I have a problem to make an independant jar from a jython script. I use Jython 2.0, with SUN JDK1.3.0 on Win2000 Pro. My script is called dir.py and contains: == begin ====== import os for file in os.listdir('.'): print file == end ======== It works well as I use the command line: jython dir.py (it shows me the list of the files of the current directory) I want to build a jar file from this script. I used this command : jythonc -a -j dir.jar dir.py It created a jar file (called dir.jar) which contains normally all the needed jython libraries needed to make it run. But as I want to run it, using the command java -jar dir.jar I got an exception : == begin ============== Java Traceback: at org.python.core.Py.JavaError(Py.java:238) at org.python.core.PyTableCode.call(PyTableCode.java:159) at org.python.core.imp.createFromCode(imp.java:157) at org.python.core.Py.runMain(Py.java:798) at dir.main(dir.java:61) Traceback (innermost last): File "C:\Documents\src\jython\test\dir.py", line 0, in main java.lang.ExceptionInInitializerError: java.lang.NullPointerException at org.python.modules.os.<clinit>(os.java:11) at java.lang.reflect.Method.invoke(Native Method) at org.python.core.PyJavaClass.initialize(PyJavaClass.java:108) at org.python.core.PyJavaClass.lookupGivingClass(PyJavaClass.java:666) at org.python.core.PyClass.lookup(PyClass.java:164) at org.python.core.PyJavaClass.__findattr__(PyJavaClass.java:712) at org.python.core.PyObject.__getattr__(PyObject.java:670) at dir$_PyInner.main$1(dir.java:43) at dir$_PyInner.call_function(dir.java:28) at org.python.core.PyTableCode.call(PyTableCode.java:155) at org.python.core.imp.createFromCode(imp.java:157) at org.python.core.Py.runMain(Py.java:798) at dir.main(dir.java:61) java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError == end ================ I solved the problem giving the root dir of jython installation as a system property: java -Dpython.home=c:\dev\jython-2.0 -jar dir.jar But it annoys me... Is the generated jar (dir.jar) still dependant of the jython installation ? Does it mean that it can't run on a workstation having only JRE installed ? If not, please help me to find out the thing or the option I missed. Thanks Pierre -- Pierre Dittgen, software engineer CRIL Telecom software E-mail: pie...@cr... Phone: (33) 1 58 17 04 64 _______________________________________________ Jython-users mailing list Jyt...@li... http://lists.sourceforge.net/lists/listinfo/jython-users |