andreasgal/j2me.js — pull request #585 by mykmelez (2014-11-14 00:56:47+00:00)
Title: specify -bootclasspath and -extdirs when compiling Java classes

`make java` warns:

> warning: [options] bootstrap class path not set in conjunction with -source 1.3

That's because the compiler expects us to specify the location of the bootstrap and extension classes for the version we specify in the *-target* flag. Otherwise, it uses the classes that came with the compiler, which may be incompatible with the ones our VM uses, leading to compile time errors, like the one @marco-c encountered while developing #583), or runtime errors, per `man javac`, whose Cross-Compilation Example says:

> The Java 2 SDk's javac would also by default compile against its own bootstrap classes, so we need to tell javac to compile against JDK 1.4 bootstrap classes instead. We do this with -bootclasspath and -extdirs. Failing to do this might allow compilation against a Java 2 Platform API that would not be present on a 1.4 VM and would fail at run-time.

So this change adds *-bootclasspath* and *-extdirs* flags to all the *javac* invocations, which suppresses the warning and fixes the compilation issue in #583.

The combinations of path flags (*-cp*, *-bootclasspath*, *-extdirs*, *-sourcepath*) may not be entirely correct. For example, maybe we should actually replace *-cp* with *-bootclasspath* when compiling the *custom* directory. But this appears to output the correct set of class files.