Download emk: .zip .tar.gz View On GitHub

Java Module

The java module is an emk module for compiling Java code and creating jar files. This module will autodetect .java files in the current directory, compile them (with javac), and create a jar file out of the compiled classes. It will also autodetect classes that contain a main() method; for each class with a main() method, the java module will create an executable jar (named <class name>.jar) that can be run using “java -jar <class name>.jar”.

Note that autodetection of main() methods will only work if the main() method is in the toplevel class in the .java file (ie, it won’t work if the main() method is in a static inner class). However you can explicitly define classes that contain a main() method using the exe_classes property.

You can use the depdirs or projdirs properties to specify other directories (that emk builds in) that the Java files in the current directory depend on. Using the jar_in_jar or exe_jar_in_jar properties, you can tell emk to merge the jar files creates for those other directories into the jar file created for this directory. Currently, the jar_in_jar/exe_jar_in_jar properties will only cause the emk-managed dependency jar contents to be included in the jar file - this does not include the sysjars (ie, jar files that are built externally to emk).


All properties are inherited from the parent scope if there is one.