1--- 2title: Java 3short-description: Compiling Java programs 4... 5 6# Compiling Java applications 7 8Meson has experimental support for compiling Java programs. The basic syntax consists of only one function and would be used like this: 9 10```meson 11project('javaprog', 'java') 12 13myjar = jar('mything', 'com/example/Prog.java', 14 main_class : 'com.example.Prog') 15 16test('javatest', myjar) 17``` 18 19However note that Meson places limitations on how you lay out your code. 20 21* all Java files for a jar must be under the subdirectory the jar definition is in 22* all Java files must be in paths specified by their package, e.g. a class called `com.example.Something` must be in a Java file situated at `com/example/Something.java`. 23* Meson only deals with jar files, you cannot poke individual class files (unless you do so manually) 24