Re: How do I make this easily usable by others? possible bug?
Moore, Greg <Greg_W_Moore <at> adp.com>
2007-08-01 19:08:54 GMT
Hello Again,
I just wanted to let you know I was successful, thanks to all your help
(Charlie and Odi). I was able to put all the java classes I needed under
\org and the *.py under \lib and it all worked wonderfully. I now have a
jumbo all in one jar file that works great! Odi I'd like you permission
to use some of the info on your web page to create a wiki entry that
documents what I did so it might help others.
However, I did notice something odd when I was trying the classpath
method.
This gets a little lengthy sorry about that.
I get different results when typing in commands into the interpreter
then I do when I specify a script on the commandline. This only seems to
happen with the standalone jar I did not see this with the
non-standalone installation. Let me explain a little further:
On Windows XP sp2 with the following Environment:
PATH="c:\Program Files\Java\jre1.5.0_11\bin"
CLASSPATH=c:\dist\lib\commons-codec-1.3.jar;c:\dist\lib\commons-logging-
1.0.4.jar;c:\dist\lib\commons-httpclient-3.1-rc1.jar;c:\dist\lib\dom4j-1
.6.1.jar;c:\dist\lib\jaxen-1.1.1.jar;c:\dist\lib\log4j-.2.8.jar;"c:\Prog
ram Files\Java\jre1.5.0_11\lib\rt.jar"
This is what I saw:
C:\jython2.2>java -cp %classpath%;.\jythonStandalone.jar
org.python.util.jython
Jython 2.2rc2 on java1.5.0_11
Type "copyright", "credits" or "license" for more information.
>>> from javax import swing
Traceback (innermost last):
File "<console>", line 1, in ?
ImportError: cannot import name swing
>>> from javax import *
Traceback (innermost last):
File "<console>", line 1, in ?
ImportError: no module named javax
>>> ^Z
However everything works fine if I use, for example, the Jython Console
from http://code.google.com/p/jythonconsole/ using a similar command to
the one above: C:\jython2.2>java -cp %classpath%;.\jythonStandalone.jar
org.python.util.jython c:\Libs\jythonconsole-0.0.4\console.py
At the top of console.py there are a bunch of swing imports.
Just for the purposes of completeness, If I type in a line like "from
java import *" or "from java.lang import String" everything works fine
and there are no import errors.
Here are some other tests I ran if your interested
C:\jython2.2>java -cp %classpath%;.\jythonStandalone.jar
org.python.util.jython
Jython 2.2rc2 on java1.5.0_11
Type "copyright", "credits" or "license" for more information.
>>> from org.dom4j import *
Traceback (innermost last):
File "<console>", line 1, in ?
ImportError: no module named dom4j
>>> from org.apache.commons.httpclient import *
Traceback (innermost last):
File "<console>", line 1, in ?
ImportError: no module named apache
>>> from org.apache.commons import *
Traceback (innermost last):
File "<console>", line 1, in ?
ImportError: no module named apache
>>> import org
>>> dir
<built-in function dir>
>>> dir(org)
['__name__', 'python']
>>> ^Z
Now Using the SAME environment settings but the NON standalone jar every
thing seems to work just fine. As shown below.
C:\jython2.2>java -cp %classpath%;.\jython.jar org.python.util.jython
*sys-package-mgr*: processing new jar,
'C:\dist\lib\commons-codec-1.3.jar'
*sys-package-mgr*: processing new jar,
'C:\dist\lib\commons-logging-1.0.4.jar'
*sys-package-mgr*: processing new jar,
'C:\dist\lib\commons-httpclient-3.1-rc1.jar'
*sys-package-mgr*: processing new jar, 'C:\dist\lib\dom4j-1.6.1.jar'
*sys-package-mgr*: processing new jar, 'C:\dist\lib\jaxen-1.1.1.jar'
*sys-package-mgr*: processing new jar, 'C:\dist\lib\log4j-1.2.8.jar'
*sys-package-mgr*: processing new jar, 'C:\Program
Files\Java\jre1.5.0_11\lib\rt.jar'
*sys-package-mgr*: processing new jar, 'C:\Program
Files\Java\jre1.5.0_11\lib\jsse.jar'
*sys-package-mgr*: processing new jar, 'C:\Program
Files\Java\jre1.5.0_11\lib\jce.jar'
*sys-package-mgr*: processing new jar, 'C:\Program
Files\Java\jre1.5.0_11\lib\ext\dnsns.jar'
*sys-package-mgr*: processing new jar, 'C:\Program
Files\Java\jre1.5.0_11\lib\ext\sunjce_provider.jar'
*sys-package-mgr*: processing new jar, 'C:\Program
Files\Java\jre1.5.0_11\lib\ext\sunpkcs11.jar'
Jython 2.2rc2 on java1.5.0_11
Type "copyright", "credits" or "license" for more information.
>>> from javax import *
>>>
Sorry this got a little longwinded. But I don't know a more concise way
of documenting it.
So I guess the question is... Bug or feature? I couldn't test this with
2.1 because this appears to be specific to the standalone jar and it was
unavailable with the 2.1 release.
Regards,
Greg.
This message and any attachments are intended only for the use of the addressee and may contain information
that is privileged and confidential. If the reader of the message is not the intended recipient or an
authorized representative of the intended recipient, you are hereby notified that any dissemination of
this communication is strictly prohibited. If you have received this communication in error, please
notify us immediately by e-mail and delete the message and any attachments from your system.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/