[pHash-support] pHash + jni.h + Ubuntu

Sebastian Gallese sebastiangallese at gmail.com
Sat Jan 9 14:47:46 PST 2010


Evan,

Sweet, your tip worked!  I executed this command and pHash compiled
with Java on my Ubuntu setup

sudo CPPFLAGS=-I/usr/lib/jvm/java-6-sun/include ./configure
--enable-java && sudo make && sudo make install

As for my jni.h file, it was placed where the Synaptic Package Manager
installed Java 6
/usr/lib/jvm/java-6-sun/include/jni.h

On a side note, Ubuntu has trouble locating the jni_md.h file, so I
had to do this work around:
https://lists..com/archives/universe-bugs/2009-June/103568.html

Look forward to using pHash in Java.

Thanks,

Seb

On Sat, Jan 9, 2010 at 1:10 PM, Evan Klinger <eklinger at phash.org> wrote:
> Sebastian,
> Where is your jni.h file located? I'm thinking it works by default on
> my setup because I have gcj installed which comes packaged with its
> own jni.h file in /usr/lib/gcc/i686-redhat-linux/4.4.2/include/jni.h
> which gcc must be finding. The one from Sun's Java SDK is in
> /usr/java/jdk1.6.0_12/include/jni.h. I'll need to think about how we
> can generalize it for any Java SDK since it looks like they get
> installed in their own directory. In the meantime, you can try:
>
> CPPFLAGS=-I <path to your jni.h> ./configure --enable-java
>
> That should let gcc find the correct file. Let me know if it doesn't work.
> Thanks
> Evan
>
> On Sat, Jan 9, 2010 at 9:11 AM, Sebastian Gallese
> <sebastiangallese at gmail.com> wrote:
>> Howdy again,
>>
>> Just got back from my winter vacation and looking at compiling pHash
>> again (I'll have a go on the Mac once I figure out how to update g++).
>>  Here is my current setup:
>>
>> Ubuntu 9.10 (Karmic)
>> pHash 0.7.2
>> Sun Java 6 JDK (java-6-sun-1.6.0.15 installed from ports)
>>
>> pHash compiles without java enabled, but when I try to turn java on,
>> it can't find the jni.h file.
>>
>> make[3]: Entering directory `/home/kdge/pHash-0.7.2/bindings/java'
>> /bin/bash ../../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H
>> -I. -I../.. -I../../src  -I/usr/local/include -DHAVE_IMAGE_HASH=1
>> -DHAVE_VIDEO_HASH=1 -DHAVE_AUDIO_HASH=1 -Dcimg_use_jpeg -Dcimg_use_png
>>  -O2 -ffast-math -O3 -MT pHash-jni.lo -MD -MP -MF .deps/pHash-jni.Tpo
>> -c -o pHash-jni.lo pHash-jni.cpp
>> libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I../../src
>> -I/usr/local/include -DHAVE_IMAGE_HASH=1 -DHAVE_VIDEO_HASH=1
>> -DHAVE_AUDIO_HASH=1 -Dcimg_use_jpeg -Dcimg_use_png -O2 -ffast-math -O3
>> -MT pHash-jni.lo -MD -MP -MF .deps/pHash-jni.Tpo -c pHash-jni.cpp
>> -fPIC -DPIC -o .libs/pHash-jni.o
>> pHash-jni.cpp:2:17: error: jni.h: No such file or directory
>>
>> Full output at http://gist.github.com/272981
>>
>> Here is what my .profile looks like
>>
>> export JAVA_HOME=/usr/lib/jvm/java-6-sun
>> export JDK_HOME=/usr/lib/jvm/java-6-sun
>> export JNI_INCLUDE_DIR=/usr/lib/jvm/java-6-sun/include
>> export JAVA_INCLUDE=/usr/lib/jvm/java-6-sun/include
>> export PATH=$PATH:$JAVA_HOME/bin
>>
>> I assume something is wrong with the path class to the jni.h file.
>> For sh*** and giggles, I copied everything from
>> /usr/lib/jvm/java-6-sun/include into the pHash folder (only later to
>> delete all of them):
>> classfile_constants.h  jawt.h  jdwpTransport.h  jni.h  jvmti.h  linux
>>
>> Thus, I'm wondering how I should set my class path?  I know this is
>> more of a jni.h question rather than a pHash problem; however, none of
>> the solutions online solved my situation.  I'd like to imitate your
>> setup.
>>
>> Thanks,
>>
>> Seb
>>
>> --
>> Sebastian Gallese
>> _______________________________________________
>> pHash-support mailing list
>> pHash-support at lists.phash.org
>> http://lists.phash.org/listinfo.cgi/phash-support-phash.org
>>
>



More information about the pHash-support mailing list