Dear Davinder,
On my system (ubuntu 14.04), jni.h is in the package openjdk-7-jdk:
$ dpkg -S jni.h
openjdk-7-jdk:amd64: /usr/lib/jvm/java-7-openjdk-amd64/include/jni.h
To search a package containing a specific file your can use
http://packages.ubuntu.com/ or apt-file.
If you do not want to chase all dependencies one by one you can also install the build dependencies of octave (but the dependencies of the octave version in the repositories) by issuing the following command:
sudo apt-get build-dep octave