I'd like to reopen an issue we talked about earlier.

I'm having difficulties running PyLucene 2.4.0 (JCC 1.9, shared) on
Windows XP.  I've put the "jcc.dll" file into the
PYTHON/Lib/site-packages/lucene/ directory, which seems to work, but
it's complaining that "The application has failed to start because
jvm.dll was not found."

I think that this is going to be a persistent problem on Windows.
Even though I have the Java "bin" directory on my path, the jvm.dll is
in "bin/client", and so is not found.

What I'd like to do is to have the following prologue inserted into
the lucene/__init__.py file.  It adds the registry's current location
for jvm.dll to the end of the Path environment variable.  This means
that a location explicitly specified by the user will override this
default value, but it also means that a location for the dll will
always be found, and reduce what I expect to be one of the most
troublesome errors using JCC PyLucene on Windows.

Bill
---------------------------------------------------------------

import sys
if sys.platform == 'win32':

    # figure out where the jvm.dll is, and make sure that location is on 
sys.path
    import _winreg as wreg
    registry = wreg.ConnectRegistry(None, wreg.HKEY_LOCAL_MACHINE)
    key = wreg.OpenKey(registry, r"SOFTWARE\JavaSoft\Java Runtime Environment")
    v, t = wreg.QueryValueEx(key, "CurrentVersion")
    key = wreg.OpenKey(registry, r"SOFTWARE\JavaSoft\Java Runtime 
Environment\%s" % v)
    javahome, t = wreg.QueryValueEx(key, "JavaHome")
    registry.Close()
    # if we have a javahome, make sure it's on the list
    if javahome:
        import os
        location = os.path.join(javahome, "bin", "client")
        os.environ['Path'] = 
os.pathsep.join(os.environ['Path'].split(os.pathsep) + [location,])




_______________________________________________
pylucene-dev mailing list
pylucene-dev@osafoundation.org
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to