|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-06-16 07:10 UTC] php_public at macfreek dot nl
Description: ------------ In short, Java does not compile on Mac OS X, because the Java headers are at an other location then java.c expects them. configure does work. Reproduce code: --------------- On Mac OS X (Darwin): ./configure --with-java=/usr (you can leave the =/usr out). make Actual result: -------------- /Users/freek/Downloads/php-4.3.2/ext/java/java.c:39:24: JavaVM/jni.h: No such file or directory This is due to this code: #if HAVE_JAVAVM_JAVAVM_H #include <JavaVM/JavaVM.h> #include <JavaVM/jni.h> #define JNI_12 #else #include <jni.h> #endif In php_config.h, the precompiler directive HAVE_JAVAVM_JAVAVM_H was set, even though there is no file on my system called JavaVM/JavaVM.h As an ugly workaround, specifying the full path did work: #include </System/Library/Frameworks/JavaVM.framework/ Versions/A/Headers/JavaVM.h> #include </System/Library/Frameworks/JavaVM.framework/ Versions/1.3.1/Headers/jni.h Apparently, jni.h is not in Java VM 1.4.1, which is also installed on Mac OS X. But to be honest, I got crazy about all symbolic links in /System/Library/ Frameworks/JavaVM.framework/ PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 08:00:02 2025 UTC |
java builds fine on OSX, this is the how to config: ./configure --with-java=/System/Library/Frameworks/ JavaVM.framework/Versions/1.3.1/Home I chose 1.3.1 for compat, if you have 1.4.1 it can be used. Patch the source like so: perl -pi -e 's,DL_FETCH_SYMBOL\(dl_handle\, \"JNI_CreateJavaVM\"\),DL_FETCH_SYMBOL\(dl_handle\, \"_JNI_CreateJavaVM_Impl\"\),g' ext/java/java.c perl -pi -e 's,DL_FETCH_SYMBOL\(dl_handle\, \"JNI_GetDefaultJavaVMInitArgs\"\),DL_FETCH_SYMBOL\(dl_ handle\, \"_JNI_GetDefaultJavaVMInitArgs_Impl\"\),g' ext/java/java.c and finally the config (php.ini): java.home = /System/Library/Frameworks/ JavaVM.framework/Versions/1.3.1/Home java.library = /System/Library/Frameworks/ JavaVM.framework/Versions/1.3.1/Libraries/libjvm.dylib of course the java.class.path should equal the full path to php_java.jar and I haven't figured out the java.library.path yet from what I've read it should point to the path where java.so is created and you should make a libphp_java.so symlink to java.so (Shared version) this will get you to this error when I use the java stuff in a php file: file: $system = new Java("java.lang.System"); printf("Java version = %s\n", $system- >getProperty("java.version")); Error: Fatal error: java.lang.UnsatisfiedLinkError: no php_java in java.library.path from reading it seems that LD_LIBRARY_PATH needs to be set but that env var doesn't exist on OS X, in it's place there is DYLD_LIBRARY_PATH and LIBRARY_PATH but neither fixed it for me, if anyone can figure this out please email me.