manpagez: man pages & more
info automake
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.4 Java bytecode compilation (deprecated)

Automake provides some minimal support for Java bytecode compilation with the JAVA primary (in addition to the support for compiling Java to native machine code; see section Compiling Java sources using gcj). Note however that the interface and most features described here are deprecated. Future Automake releases will strive to provide a better and cleaner interface, which however won’t be backward-compatible; the present interface will probably be removed altogether some time after the introduction of the new interface (if that ever materializes).

Any ‘.java’ files listed in a _JAVA variable will be compiled with JAVAC at build time. By default, ‘.java’ files are not included in the distribution, you should use the dist_ prefix to distribute them.

Here is a typical setup for distributing ‘.java’ files and installing the ‘.class’ files resulting from their compilation.

javadir = $(datadir)/java
dist_java_JAVA = …

Currently Automake enforces the restriction that only one _JAVA primary can be used in a given ‘’. The reason for this restriction is that, in general, it isn’t possible to know which ‘.class’ files were generated from which ‘.java’ files, so it would be impossible to know which files to install where. For instance, a ‘.java’ file can define multiple classes; the resulting ‘.class’ file names cannot be predicted without parsing the ‘.java’ file.

There are a few variables that are used when compiling Java sources:


The name of the Java compiler. This defaults to ‘javac’.


The flags to pass to the compiler. This is considered to be a user variable (see section Variables reserved for the user).


More flags to pass to the Java compiler. This, and not JAVACFLAGS, should be used when it is necessary to put Java compiler flags into ‘’.


The value of this variable is passed to the ‘-d’ option to javac. It defaults to ‘$(top_builddir)’.


This variable is a shell expression that is used to set the CLASSPATH environment variable on the javac command line. (In the future we will probably handle class path setting differently.)

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on January 25, 2014 using texi2html 5.0.

© 2000-2017
Individual documents may contain additional copyright information.