On Tue, 9 Feb 2010, Roman Chyla wrote:
I wanted to ask if there was any progress on this issue (extending
classpath runtime):
http://lists.osafoundation.org/pipermail/pylucene-dev/2008-March/002455.html
Yes, this should work provided you invoke jcc with --shared when building
your modules.
I just verified this worked by using PyLucene and PyPDFBox together, both
built with --shared.
(Note that with a recent JCC, you no longer need to pass the classpath to
initVM(), the parameter is defaulted to the module's CLASSPATH variable):
yuzu:vajda> python
Python 2.6.2 (r262:71600, Sep 20 2009, 20:40:09)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pdfbox
>>> pdfbox.initVM(vmargs='-Djava.awt.headless=true')
<jcc.JCCEnv object at 0x1004030d8>
>>> import lucene
>>> lucene.initVM()
<jcc.JCCEnv object at 0x1004034e0>
>>> lucene.Document()
<Document: Document<>>
>>> pdfbox.PDFTextStripper()
<PDFTextStripper: org.apache.pdfbox.util.pdftextstrip...@83e96cf>
>>>
or in a different order:
yuzu:vajda> python
Python 2.6.2 (r262:71600, Sep 20 2009, 20:40:09)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import lucene, pdfbox
>>> lucene.initVM(vmargs='-Djava.awt.headless=true')
<jcc.JCCEnv object at 0x1004030d8>
>>> pdfbox.initVM()
<jcc.JCCEnv object at 0x100403150>
>>> lucene.Document()
<Document: Document<>>
>>> pdfbox.PDFTextStripper()
<PDFTextStripper: org.apache.pdfbox.util.pdftextstrip...@6548f8c8>
The vmargs='-Djava.awt.headless=true' parameter to the first initVM() is
required by pdfbox. The first initVM() call starts and initializes the Java
VM, the second one just updates its classpath and cannot change or set
vmargs.
Andi..