0

I've looked all over for an answer and it appears I need to set my $DYLD_LIBRARY_PATH to something that knows where my missing library is but I can't tell what that might be.

My machine is Mac OS X and I have PHP5 running under MAMP. I have a shell command for an executable I've created that runs fine in terminal but doesn't work at all from my PHP app. I get the following error:

$ Error occurred during initialization of VM Unable to load native library: libjava.jnilib

I think I just need to find that library and add the dir to the variable listed above but I can't seem to find it. Thanks for the help in advance!

Ben Sullins
  • 231
  • 2
  • 9

2 Answers2

0

As Broken Java Mac 10.6 mentions the DYLD_LIBRARY_PATH must be unset. Not sure why, it seems to be needed on Unix systems but not MacOSX.

If MAMP sets to /Applications/MAMP/Library/lib here's how to disable it: Edit /Applications/MAMP/Library/bin/envvars and comment out the following lines

DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH" export DYLD_LIBRARY_PATH So that it looks like this:

DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"

export DYLD_LIBRARY_PATH

This should fix the problem and java 1.6 can run fine.

For more information, check here: Java 1.6 Broken when called by background Symfony task

Community
  • 1
  • 1
Meetai.com
  • 6,622
  • 3
  • 31
  • 38
0

This also worked for me on another environment:

<?php
  exec('export DYLD_LIBRARY_PATH=""; java -version');
?>

References:
- https://drupal.org/node/1257654
- Calling java from PHP exec

Community
  • 1
  • 1
Meetai.com
  • 6,622
  • 3
  • 31
  • 38