to PHP (and specifically to Drupal)?
Writng a PHP extension is probably easier in C. Insofar, I have not seen any Java extension.
http://php-java-bridge.sourceforge.net/ And there is also a deprecated ext/java extension for PHP <= 4.3 These also have the advantage of _already_ being a PHP extension to use existing Java bytecode. Instead of a necessitating me to write an extension, I can just glue the bridge to the Weka toolkit in PHP.
and you make Java mandatory on the server. That's not a good idea.
What is more likely: a hosting service providing a JVM or providing a C/C++ compiler? For what it is worth, my host (NearlyFreeSpeech.Net) has gcc but not javac (or at least I couldn't find it in 5 minutes of looking - I haven't asked tech support yet). I don't know if this typical.
Very few if any module require any PHP extension which is not in the PHP core. Some reuqire a few scripts that are in PEAR like simpletest, but that's rare. But scripts are not extensions.
Well, until someone codes a ML library in PHP I do not see much of an option. Given the choice between producing a working (though difficult to install) module or spending a lot of effort on re-inventing the wheel, I'll choose the former. :-) -M