Importing a class, please help...

Terry Hancock hancock at anansispaceworks.com
Mon Feb 6 00:24:52 EST 2006


On Sun, 5 Feb 2006 10:41:51 -0500
"anon" <anon at nospam.nospam> wrote:
> Newbie to Python and I have a question please.  I am using
> Windows XP, SPE  0.8.2.a and Python24.  I have done this:
> 
> import sys
> print sys.path
> 
> no problem there, sys imports just fine.  I have a folder
> that I called  c\JavaProjects\PythonTesting and it shows
> up in the output from sys.path  above.  I have dropped a
> very simple Jar in that folder and I have attempted  to do
> an Import on it.  This is where things fail.  I cannot see
> the  contents of my Jar.  What am I missing here?

As others have pointed out, ".jar" is going to be Java
bytecode, and from that strange looking path (was, I assume
supposed to be "C:\JavaProjects\PythonTesting"), it looks
very much like you really wanted to be using Jython (a.k.a
"Java Python") rather than Python (a.k.a. "C Python").

Perhaps you have both Jython and Python 2.4 installed and
you are launching the latter when you meant the former?

In any case, C Python cannot load Java classes (that's the
main raison d'etre for Jython).

 -- 
Terry Hancock (hancock at AnansiSpaceworks.com)
Anansi Spaceworks http://www.AnansiSpaceworks.com




More information about the Python-list mailing list