Libraries are handled a little differently for the Java grade. Instead of compiling object code into a static or shared library, the class files are added to a jar (Java ARchive) file of the form library-name.jar.
To create or install a Java library, simply specify that you want to use the java grade, either by setting ‘GRADE=java’ in your Mmakefile, or by including ‘--java’ or ‘--grade java’ in your ‘GRADEFLAGS’, then follow the instructions as above.
Java libraries are installed to the directory prefix/lib/mercury/lib/java. To include them in a program, in addition to the instructions above, you will need to include the installed jar file in your ‘CLASSPATH’, which you can set using ‘--java-classpath jarfile’ in ‘MCFLAGS’.