function jikes_compile($src_path, $target_path, $verbose, $extra_classpath = '')
{
    // Initialize path to jikes. First assume jikes is in the same directory as this script
    $jikes_pp = explode('/', __FILE__);
    $jikes_pp[count($jikes_pp) - 1] = 'jikes';
    $jikes_cmd = implode('/', $jikes_pp);
    if (!file_exists($jikes_cmd)) {
        $jikes_cmd = $jikes_cmd . '.exe';
        if (!file_exists($jikes_cmd)) {
            $jikes_cmd = 'jikes';
            // Try path
        }
    }
    $src_path = realpath($src_path);
    mkpath($target_path, 0750);
    $target_path = realpath($target_path);
    $System = new JavaClass("java.lang.System");
    $Properties = $System->getProperties();
    $java_home = $Properties->get("java.home");
    $classpath = $Properties->get("java.class.path");
    if ($extra_classpath != '') {
        $classpath .= ":{$extra_classpath}";
    }
    $bootclasspath = $Properties->get("sun.boot.class.path");
    $target_version = $Properties->get("java.specification.version");
    clearstatcache();
    // Neccessary, otherwise file modification dates and calls to "file_exists" get cached.
    $files = dir_pattern_scan($src_path, "\\.java\$", '/', 6);
    $files = filter_unmodified($files, $src_path, $target_path);
    if (count($files) == 0) {
        return 0;
    }
    $filearg = implode(' ', $files);
    $output = array();
    if ($verbose) {
        $command = "{$jikes_cmd} -Xstdout -verbose ";
    } else {
        $command = "{$jikes_cmd} -Xstdout ";
    }
    $command .= "-bootclasspath {$bootclasspath} -classpath {$classpath}:{$target_path} -target {$target_version} -source {$target_version} ";
    $command .= "-sourcepath {$src_path} -d {$target_path} {$filearg}";
    $retval = -99999;
    exec($command, $output, $retval);
    if ($retval == 126) {
        throw new JavaCompilationException($command, "No execute permission for '{$jikes_cmd}'", $retval);
    }
    if ($retval == 127) {
        throw new JavaCompilationException($command, "Jikes Executable '{$jikes_cmd}' not found", $retval);
    }
    if ($retval != 0) {
        throw new JavaCompilationException($command, implode("\n", $output), $retval);
    }
    return count($files);
}
// -------------- adjust these variables, if necessary
$server = array_key_exists(1, $argv) ? $argv[1] : SERVER::JBOSS;
$WAS_HOME = array_key_exists(2, $argv) ? $argv[2] : "/opt/IBM/WebSphere/AppServer";
$JBOSS_HOME = array_key_exists(2, $argv) ? $argv[2] : "/opt/jboss-4.0.2/";
$app_server = array_key_exists(2, $argv) ? $argv[2] : getenv("HOME") . "/SUNWappserver";
$HOST = array_key_exists(3, $argv) ? $argv[3] : "127.0.0.1";
// ---------------
if ($argc < 3 || $argc > 4) {
    echo "Usage: php documentClient.php SERVER SERVER_DIR REMOTE_HOST\n";
    echo "Example: php documentClient.php 1 /opt/jboss-4.0.3SP1 localhost\n";
    echo "Example: php documentClient.php 2 /opt/IBM/WebSphere/AppServer localhost\n";
    echo "Example: php documentClient.php 3 /opt/SUNWappserver localhost\n";
    exit(1);
}
$System = new JavaClass("java.lang.System");
$props = $System->getProperties();
echo "Using java VM from: {$props['java.vm.vendor']}\n";
echo "connecting to server: ";
$clientJar = getcwd() . "/documentBeanClient.jar";
switch ($server) {
    case SERVER::JBOSS:
        echo "jboss. Loading {$JBOSS_HOME}/lib \n";
        if (!java_values($props['java.vm.vendor']->toLowerCase()->startsWith("sun"))) {
            echo "WARNING: You need to run this example with the SUN VM\n";
        }
        if (!is_dir($JBOSS_HOME)) {
            die("ERROR: Incorrect {$JBOSS_HOME}.");
        }
        $name = "DocumentEJB";
        java_require("{$JBOSS_HOME}/client/;{$clientJar}");
        $server = array("java.naming.factory.initial" => "org.jnp.interfaces.NamingContextFactory", "java.naming.provider.url" => "jnp://{$HOST}:1099");