Question

When I want to import jnius there is an error like:

Traceback (most recent call last):
...
File "C:\Python27\lib\site-packages\jnius\__init__.py", line 12, in <module>
    from .jnius import *
ImportError: DLL load failed: The specified module could not be found.

I need jnius in order to use: https://github.com/kevlened/sikuli_cpython

What I have and use:

  • Windows 7 Enterprise x64
  • Python 2.7.6 x86
  • Cython-0.19.2
  • jnius-1.1-dev
  • JDK 7 Update 45 x86
Was it helpful?

Solution

Add the following to your Path environment variable (under "system variable"):

C:\Program Files (x86)\Java\jdk[YOUR JDK VERSION]\jre\bin\server

-or-

C:\Program Files (x86)\Java\jre[YOUR JDK VERSION]\bin\client

This was pointed out here, and it also points out you should set the JAVA_HOME "user variable":

C:\Program Files (x86)\Java\jdk[YOUR JDK VERSION]

Since jnius is a java wrapper, the "DLL" that fails to load may often be the "jvm.dll" located in that "server" folder.

Then again, there could be other DLL files missing. Ensure you have msvcr90 or msvcr100 and others provided by installing visual studio 2008 or 2010 redistributable. A more complete answer to your question can be found by downloading dependency walker and analyzing the required DLLs for jnius.pyd (I think I remember from personal experience it does require msvcr100 and msvcr90).

OTHER TIPS

For Adopt OpenJDK use C:\Program Files\AdoptOpenJDK\jdk-8.0.212.04-hotspot\jre\bin\server

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top