M
Mitch Amiano
I'm getting started working with Jython (hope this is an ok group for
the question), and ran into a stumbling block using the jythonc tool.
It is a fairly simple Jython script which uses the Apache Batik SVG
library, imports the SVG Canvas, and puts up a simple Swing interface to
let the user load and display an SVG file. (I translated the script from
a Batik Java example.) The script runs fine under jython, but so far
I've been unable to get a working jar file using jythonc.
After various problems involving CLASSPATH and the registry (protected
members not showing up), it is persistently giving a ZipException:
Duplicate entry error on the PyMethod class. Altering the CLASSPATH
seems to have no effect on the problem.
Is this a problem between jythonc and newer jvms? I've also tried with
j2sdk 1.4.2_05, with the same results.
I've exhausted other means, and at my wits end.
Thanks in advance for any pointers.
My command line is:
C:\jython-2.1\jythonc.bat --compiler C:\jdk1.5.0_01\bin\javac.exe --all
-j usebatik.jar usebatik.py
The output is:
processing usebatik
Required packages:
javax.swing
org.w3c.dom
java.awt.event
java.lang
java.io
org.apache
Creating adapters:
java.awt.event.ActionListener used in usebatik
Creating .java files:
usebatik module
Compiling .java to .class...
Compiling with args: ['C:\\jdk1.5.0_01\\bin\\javac.exe', '-classpath',
'C:\\jython-2.1\\jython.jar;;.\\jpywork;;C:\\jython-2.1\\Tools\\jythonc;C:\\Documents
and Settings\\Valued
Customer\\Desktop\\Grazer\\usebatik\\.;C:\\jython-2.1\\Lib;C:\\jython-2.1',
'.\\jpywork\\usebatik.java']
0 Note: * uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Building archive: usebatik.jar
Tracking java dependencies:
Traceback (innermost last):
File "C:\jython-2.1\Tools\jythonc\jythonc.py", line 5, in ?
File "C:\jython-2.1\Tools\jythonc\main.py", line 301, in main
File "C:\jython-2.1\Tools\jythonc\main.py", line 294, in writeResults
File "C:\jython-2.1\Tools\jythonc\jar.py", line 98, in dump
File "C:\jython-2.1\Tools\jythonc\jar.py", line 92, in dumpFiles
File "C:\jython-2.1\Tools\jythonc\jar.py", line 111, in addPackage
java.util.zip.ZipException: duplicate entry: org/python/core/PyMethod.class
at java.util.zip.ZipOutputStream.putNextEntry(Unknown Source)
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java)
at org.python.core.PyMethod.__call__(PyMethod.java)
at org.python.core.PyObject.__call__(PyObject.java)
at org.python.core.PyInstance.invoke(PyInstance.java)
at jar$py.addPackage$11(C:\jython-2.1\Tools\jythonc\jar.py:111)
at jar$py.call_function(C:\jython-2.1\Tools\jythonc\jar.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at org.python.core.PyInstance.invoke(PyInstance.java)
at jar$py.dumpFiles$9(C:\jython-2.1\Tools\jythonc\jar.py:92)
at jar$py.call_function(C:\jython-2.1\Tools\jythonc\jar.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at org.python.core.PyInstance.invoke(PyInstance.java)
at jar$py.dump$10(C:\jython-2.1\Tools\jythonc\jar.py:98)
at jar$py.call_function(C:\jython-2.1\Tools\jythonc\jar.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at org.python.core.PyInstance.invoke(PyInstance.java)
at main$py.writeResults$8(C:\jython-2.1\Tools\jythonc\main.py:294)
at main$py.call_function(C:\jython-2.1\Tools\jythonc\main.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at main$py.main$9(C:\jython-2.1\Tools\jythonc\main.py:301)
at main$py.call_function(C:\jython-2.1\Tools\jythonc\main.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at org.python.core.PyObject.invoke(PyObject.java)
at org.python.pycode._pyx0.f$0(C:\jython-2.1\Tools\jythonc\jythonc.py:5)
at
org.python.pycode._pyx0.call_function(C:\jython-2.1\Tools\jythonc\jythonc.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at org.python.core.__builtin__.execfile_flags(__builtin__.java)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java)
at org.python.util.jython.main(jython.java)
java.util.zip.ZipException: java.util.zip.ZipException: duplicate entry:
org/python/core/PyMethod.class
FYI, my CLASSPATH is:
SET CLASSPATH=batik-1.5.1/batik.jar;batik-1.5.1/batik-squiggle.jar;
batik-1.5.1/batik-rasterizer.jar;batik-1.5.1/batik-slideshow.jar;batik-1.5.1/batik-svgpp.jar;
batik-1.5.1/batik-ttf2svg.jar;batik-1.5.1/lib/batik-awt-util.jar;batik-1.5.1/lib/batik-bridge.jar;
batik-1.5.1/lib/batik-css.jar;batik-1.5.1/lib/batik-dom.jar;batik-1.5.1/lib/batik-ext.jar;
batik-1.5.1/lib/batik-extension.jar;batik-1.5.1/lib/batik-gui-util.jar;batik-1.5.1/lib/batik-gvt.jar;
batik-1.5.1/lib/batik-parser.jar;batik-1.5.1/lib/batik-script.jar;batik-1.5.1/lib/batik-svg-dom.jar;
batik-1.5.1/lib/batik-svggen.jar;batik-1.5.1/lib/batik-swing.jar;batik-1.5.1/lib/batik-transcoder.jar;
batik-1.5.1/lib/batik-util.jar;batik-1.5.1/lib/batik-xml.jar;batik-1.5.1/lib/js.jar;
batik-1.5.1/lib/pdf-transcoder.jar;batik-1.5.1/lib/xerces_2_5_0.jar;batik-1.5.1/lib/xml-apis.jar;
batik-1.5.1/lib/jython.jar;
the question), and ran into a stumbling block using the jythonc tool.
It is a fairly simple Jython script which uses the Apache Batik SVG
library, imports the SVG Canvas, and puts up a simple Swing interface to
let the user load and display an SVG file. (I translated the script from
a Batik Java example.) The script runs fine under jython, but so far
I've been unable to get a working jar file using jythonc.
After various problems involving CLASSPATH and the registry (protected
members not showing up), it is persistently giving a ZipException:
Duplicate entry error on the PyMethod class. Altering the CLASSPATH
seems to have no effect on the problem.
Is this a problem between jythonc and newer jvms? I've also tried with
j2sdk 1.4.2_05, with the same results.
I've exhausted other means, and at my wits end.
Thanks in advance for any pointers.
My command line is:
C:\jython-2.1\jythonc.bat --compiler C:\jdk1.5.0_01\bin\javac.exe --all
-j usebatik.jar usebatik.py
The output is:
processing usebatik
Required packages:
javax.swing
org.w3c.dom
java.awt.event
java.lang
java.io
org.apache
Creating adapters:
java.awt.event.ActionListener used in usebatik
Creating .java files:
usebatik module
Compiling .java to .class...
Compiling with args: ['C:\\jdk1.5.0_01\\bin\\javac.exe', '-classpath',
'C:\\jython-2.1\\jython.jar;;.\\jpywork;;C:\\jython-2.1\\Tools\\jythonc;C:\\Documents
and Settings\\Valued
Customer\\Desktop\\Grazer\\usebatik\\.;C:\\jython-2.1\\Lib;C:\\jython-2.1',
'.\\jpywork\\usebatik.java']
0 Note: * uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Building archive: usebatik.jar
Tracking java dependencies:
Traceback (innermost last):
File "C:\jython-2.1\Tools\jythonc\jythonc.py", line 5, in ?
File "C:\jython-2.1\Tools\jythonc\main.py", line 301, in main
File "C:\jython-2.1\Tools\jythonc\main.py", line 294, in writeResults
File "C:\jython-2.1\Tools\jythonc\jar.py", line 98, in dump
File "C:\jython-2.1\Tools\jythonc\jar.py", line 92, in dumpFiles
File "C:\jython-2.1\Tools\jythonc\jar.py", line 111, in addPackage
java.util.zip.ZipException: duplicate entry: org/python/core/PyMethod.class
at java.util.zip.ZipOutputStream.putNextEntry(Unknown Source)
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java)
at org.python.core.PyMethod.__call__(PyMethod.java)
at org.python.core.PyObject.__call__(PyObject.java)
at org.python.core.PyInstance.invoke(PyInstance.java)
at jar$py.addPackage$11(C:\jython-2.1\Tools\jythonc\jar.py:111)
at jar$py.call_function(C:\jython-2.1\Tools\jythonc\jar.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at org.python.core.PyInstance.invoke(PyInstance.java)
at jar$py.dumpFiles$9(C:\jython-2.1\Tools\jythonc\jar.py:92)
at jar$py.call_function(C:\jython-2.1\Tools\jythonc\jar.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at org.python.core.PyInstance.invoke(PyInstance.java)
at jar$py.dump$10(C:\jython-2.1\Tools\jythonc\jar.py:98)
at jar$py.call_function(C:\jython-2.1\Tools\jythonc\jar.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at org.python.core.PyInstance.invoke(PyInstance.java)
at main$py.writeResults$8(C:\jython-2.1\Tools\jythonc\main.py:294)
at main$py.call_function(C:\jython-2.1\Tools\jythonc\main.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at main$py.main$9(C:\jython-2.1\Tools\jythonc\main.py:301)
at main$py.call_function(C:\jython-2.1\Tools\jythonc\main.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyFunction.__call__(PyFunction.java)
at org.python.core.PyObject.invoke(PyObject.java)
at org.python.pycode._pyx0.f$0(C:\jython-2.1\Tools\jythonc\jythonc.py:5)
at
org.python.pycode._pyx0.call_function(C:\jython-2.1\Tools\jythonc\jythonc.py)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at org.python.core.__builtin__.execfile_flags(__builtin__.java)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java)
at org.python.util.jython.main(jython.java)
java.util.zip.ZipException: java.util.zip.ZipException: duplicate entry:
org/python/core/PyMethod.class
FYI, my CLASSPATH is:
SET CLASSPATH=batik-1.5.1/batik.jar;batik-1.5.1/batik-squiggle.jar;
batik-1.5.1/batik-rasterizer.jar;batik-1.5.1/batik-slideshow.jar;batik-1.5.1/batik-svgpp.jar;
batik-1.5.1/batik-ttf2svg.jar;batik-1.5.1/lib/batik-awt-util.jar;batik-1.5.1/lib/batik-bridge.jar;
batik-1.5.1/lib/batik-css.jar;batik-1.5.1/lib/batik-dom.jar;batik-1.5.1/lib/batik-ext.jar;
batik-1.5.1/lib/batik-extension.jar;batik-1.5.1/lib/batik-gui-util.jar;batik-1.5.1/lib/batik-gvt.jar;
batik-1.5.1/lib/batik-parser.jar;batik-1.5.1/lib/batik-script.jar;batik-1.5.1/lib/batik-svg-dom.jar;
batik-1.5.1/lib/batik-svggen.jar;batik-1.5.1/lib/batik-swing.jar;batik-1.5.1/lib/batik-transcoder.jar;
batik-1.5.1/lib/batik-util.jar;batik-1.5.1/lib/batik-xml.jar;batik-1.5.1/lib/js.jar;
batik-1.5.1/lib/pdf-transcoder.jar;batik-1.5.1/lib/xerces_2_5_0.jar;batik-1.5.1/lib/xml-apis.jar;
batik-1.5.1/lib/jython.jar;