support for java.library.path on osx

I'm not sure if you want to merge this patch as-is but with these changes the demos will launch for me on OSX.