Hi Lukasz,

Thank you for the patch. Comments inline.

On Fri, 5 Aug 2011, ?ukasz Jancewicz wrote:

By the way, I discovered some other issues while using JCC in my project:

1) In __init__.py of generated code, you set a CLASSPATH variable, but
then you don't use it anywhere. When I added gentyref.jar to the
classpath, I was getting ClassDefNotFound errors. Somehow, your
"classes" dir is found anyway without it. My solution: import
CLASSPATH from jcc and use env._addClassPath(CLASSPATH) after
initialising Java VM. I'm not certain that this is the perfect
solution, but it worked for me.

The CLASSPATH from the generated __init__.py file is used line 400 in jcc.cpp and on.

The CLASSPATH from jcc's __init__.py itself was unused indeed since wasn't set to the _jcc module and thus not found by jcc.cpp. This may have gone unnoticed because jcc itself doesn't normally use any java classes that are not in the JRE.

The classes in jcc's 'classes' directory are used by the libjcc runtime lib when running jcc-generated modules built with shared mode. I added _jcc.CLASSPATH = CLASSPATH to jcc's __init__.py file and classpath is now initialized to _jcc.CLASSPATH before parsing command line args instead of starting empty.

2) I needed to use one class from Tika that was not public. I know
that I could just modify Tika to make the class public, but I think
sometimes you don't have access to library source code and want to use
it anyway. I made a small modification so that if you explicitly enter
the class name (not the jar containing it) as one of JCC arguments, it
is exposed even if it's not public.

Thank you for the feature, I integrated that patch.

3) you're mixing tabs and spaces in several places in Python code.

Oops, that's not good. Thank you for pointing it out. Fixed.

I've attached a patch file with these changes. If you feel that any of
them might improve JCC, please add them.

Thanks again for your help!

You're welcome !

Andi..

Reply via email to