Linking a dynamic library (libjvm.dylib) in Mac OS X (rpath issue)
I do have an application that requires linkage with libjvm (a library from the JDK needed to do JNI bindings). When I tell the location of libjvm.dylib using -L it successfully compiles and links. However when I run the binary I get: dyld: Library not loaded: @rpath/libjvm.dylib Referenced from: <my home directory>/./mybinary Reason: image not found So far I found out that I can run my binary specifying LD_LIBRARY_PATH like so: LD_LIBRARY_PATH=<path to libfolder installation> ./mybinary But of course I do not want that. Why should I specify the exact location anyway if I have to give it again