Installing jpype in Mountain Lion

2.6k views Asked by At

I am trying to install jpype in Mountain Lion. I followed all the steps suggested in this post: How to install JPype on OS X Lion to use with Neo4j?

However, there is a glitch with Mountain Lion. I have modified the setupMacOSX() function as follows:

/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/JavaVM.framework/

But when I run $ sudo python setup.py install I get the following error:

src/native/common/include/jpype.h:45:10: fatal error: 'jni.h' file not found

I have located the jni.h header here:

/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/jni.h

But since jni.h is not part of Mountain Lion, I have not figured out how to modify the setup.py file to fix the bug. Any suggestions?

1

There are 1 answers

0
Daniel Rucci On

This is on a system running OSX 10.8.5.

I modified the setup.py for JPype-0.5.4.2 and added an element to the end of the self.includeDirs list which is created in the function setupInclusion. This function is declared at line 61 for this particular version of JPype.

     def setupInclusion(self):
          self.includeDirs = [
              self.javaHome+"/include", 
              self.javaHome+"/include/"+self.jdkInclude,
              "src/native/common/include",
              "src/native/python/include",

              #I added this line below. The folder contains a jni.h
              "/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/"
          ]

Finally I ran pip install ~/Path/To/JPype-folder/ and the installation was successful.