Running PDFNet for JAVA on Mac OS X, Linux

Q: I have some problems runing PDFNetC in JAVA

javac -classpath .:/Users/garyl/Sites/test/pdfsearch/lib/PDFNetC/Lib/

java -classpath .:/Users/garyl/Sites/test/pdfsearch/lib/PDFNetC/Lib/
PDFNet.jar PDFSearch "google file system" "150" "page" /Users/garyl/
Sites/test/pdfsearch/input/input.pdf /Users/garyl/Sites/test/
(After PDFSearch, there are parameter for the search. Don't worry

Exception in thread "main" java.lang.UnsatisfiedLinkError: no
in java.library.path
  at java.lang.ClassLoader.loadLibrary(
  at java.lang.Runtime.loadLibrary0(
  at java.lang.System.loadLibrary(
  at pdftron.PDF.PDFNet.<clinit>(
  at PDFSearch.main(

line 145 is PDFNet.initialize(); I guess it cannot find the library.

Download link of the code:

Are you able to run any of the JAVA samples? (‘cd /PDFNet/Samples’,
then ‘sh’).

It is most likely that Java can’t find the shared library.

If you are developing using JAVA on MAC OS X →

On Mac OS X, there is a weird naming convention (which is different
from Linux) - Java shared libraries must have an extension “.jnilib”
instead of “.dylib”. In case of PDFNet, the same shared library is
used for both JAVA and C/C++ development. In case you are developing
using Java on Mac, you can copy and rename libPDFNet.dylib into

To let Java know about the library, you can either pass in the path
with the -Djava.library.path option or by copying ‘libPDFNet.jnilib’
into /Library/Java/Extensions/.

If you are developing using JAVA on LINUX →

Setting LD_LIBRARY_PATH for my test project seems to do the trick:

java -classpath .:/PDFNet/Lib/PDFNet.jar MyTest

For more info, please search “LD_LIBRARY_PATH” on the Net.
In case you would like to avoid setting the “LD_LIBRARY_PATH”, you may
to copy the shared library to a standard search path for shared
(e.g. ‘/usr/local/lib’). There are other options, such as using
‘rpath’ etc.