Here are the instructions I introduced in my README to install JPype on OS X 10.7. Same idea as the answers here, but different enough to guarantee a submission.
The python interface for java (JPype) needs mods for setup.py: In general, you need to make sure that the JPype setup.py script can see your Java “Headers” and “Home” directory I had to install Java from Apple first, so how my default installation of OS X did not turn on with headers on a typical Java installation path, which I found by doing:
/usr/libexec/java_home
If you have a Headers directory, you probably won’t need to reinstall Java and you can set the paths to them below based on your Java directory, which is most likely different from those listed in these directions.
After installing Java, I found a new installation in:
/Library/Java/JavaVirtualMachines/
My home directory:
/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home/
and my header directory:
/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Headers/
1) The JPype script assumes the headers are in the home directory, but this is not so, so I changed the original var path and created a new var contents path in the setup.py script file - In setupMacOSX(self)
:
self.javaHome = '/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home/' self.javaContents = '/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/'
2) In setupMacOSX(self)
change self.libraryDir
:
self.libraryDir = [self.javaContents + "/Libraries"]
- Please note that this step was indicated as needed, but I did not need to do this to make it work, so try without it first.
3) In the setupInclusion parameter, add the paths to the Home / Enable directory and the Headers directory:
self.javaHome+"/include", self.javaContents + "/Headers",
4) Starting the installation should now work:
sudo python setup.py install