BuiltWithNOF
javam Home

jjavam version 1.0(alpha) was created by me (Lee McCauley) for personal use because I'm lazy. I got tired of having to write complex make files for my Java projects when Java should be able to do this for you. In essence, javam can be used like any make utility but it can also generate its own platform-independent XML format dependency files using Java reflection and the "javap" tool.

I welcome any bug reports and any suggestions. You can e-mail me at tlmccauley@users.sourceforge.net or, better yet, put a description of the bug or feature request on the SourceForge site (linked below).

javam is an OpenSource project hosted by SourceForge.net. The project summary page includes source code and some additional information related to the OpenSource project.

Download: latest version

REQUIREMENTS
The utility requires that you have JDK 1.4.0 or higher and (at the moment) use "javac" as your compiler.   
 

INSTALLATION
There are two main files in the archive: "javam.com" and "javam.class". Javam.com is only for Microsoft OS users and serves only as a shortcut to running the utility through the Java VM. Actually it is just a batch file compiled with Bat2exec.exe.  Other OS users can create their own shortcuts. Javam.com should be put in your path (I use "%JAVA_HOME%\bin") and javam.class should be put in your classpath (I use "%JAVA_HOME%\lib").
 

HOW IT WORKS
javam has the following command line structure:

If using the "javam.com" method for Windows,
    
javam [options] Full.Class.Name
example: javam mystuff.util.MyClass

If not using the "javam.com" method,
    
java javam [options] Full.Class.Name
example: java javam mystuff.util.MyClass

Note that the Full.Class.Name is the class name as it would appear in the code.  In other words, the complete package with class name and it is case-sensitive.

javam uses two different methods of determining the dependency information for a class. The primary method is to use a dependency file (a make file); the secondary method is to use internal Java capabilities like Reflection. Of course, the secondary method is dependent on the availability of previously compiled class files.  This means that the secondary method could determine a dependency incorrectly if the new code for a class has removed a dependency from the previously compiled version. This is the main reason why the dependency file is the primary method. Even so, this is still an easier way to create the dependency files.

Once the dependency list is created using one or both of the methods just mentioned, javam begins the compilation process.  With each class in its list, it finds the .java and .class files and uses the date stamp on each to decide if the source file is newer than the class file. If so, it spawns an external process to compile that source file.  Any output by the compiler is displayed to the user.
 

OPTIONS

     -x <excludeFile>

use named exclude file.  Without this switch, javam will look for "exclude.xml" in the current working directory.

     -xd

do not use default excluded classes for  JDK 1.4.0 (java.*;javax.*;org.*;sun.*).  Unless this option is used, javam will automatically exclude any primitive classes and any classes that match the patterns listed above. This is true even if there is no exclude file.  Even if this option is used, primitive classes will always be excluded.

This should be used with an additional exclude file, either a default one or one specified in the "-x" option.

     -f <dependenceFile>

use named dependence file. Without this option, javam will attempt to use the file "jmakefile.xml" in the current working directory. If no dependence file (either specified or default) exists and the "-u" option is used, then the dependence file will be created.

     -classpath <classpath>

use the specified classpath for compilation.

     -r

force recompile of all classes.  This option overrides the date checking usually done and recompiles all files in the dependence list for the class specified on the command line.

     -u

update/create dependence file. This option turns on the writing of the dependence file. The "-auto" option must be used in conjunction with this option for there to be any affect from this switch.

     -auto

Use internal Java capabilities to determine dependencies. By default, javam only uses the dependency file to determine dependencies. This option allows it to use its full repertoire of capabilities.  This slows down compilation but can be used with the "-u" option to generate or update a dependency file.  Note that this option can be used without writing the results to the dependency file, but the "-u" would not have any affect if it is not also used with this option.

     -C<compilerOption>

Passes through the string 'compilerOption' to the compiler.  For example, to compile with full debug information generated ("-g" option in javac) would be "-C-g".

     -h or -?

displays the help text and exits.


FUTURE ADDITIONS
The ability to define commands would be of use.  Also, the ability to use virtual class definitions in the dependency file would allow for more complex builds with multiple root classes.  This is like the common "all" target in UNIX make utilities.  Another feature would be the ability to delete class listings from the dependency file based on the internal recursion with a smart prompt so that the developer has ultimate control.

 

SourceForge Logo

[Home] [Contact]