Note: the AcmeStudio/ArchJava IDE that was available here is now pretty badly out of date. You can look here if you want to check it out, but we do not recommend its use at present and can no longer maintain it.
The original ArchJava compiler is a command-line tool similar to javac.
Write your program in one or more files with a .archj extension. Run the compiler with the command:
archj file1.archj file2.archj file3.archj ...
The compiler is a drop-in replacement for javac. It will recursively compile any referenced ArchJava source file that is not up to date.
To try out the Capitalize example from the examples directory, open a shell window (or MS-DOS prompt) and change to the ArchJava/examples directory. To compile the example, make sure the current directory "." is in your CLASSPATH, and type:
archj capitalize/Main.archj
You can then run the example by typing:
java capitalize.Main < capitalize/Main.archj
You should see the Main.archj file with alternating uppercase and lowercase characters. Note: make sure that the current directory . is in your classpath. Windows users should replace / with \ in the preceeding examples.
The ArchJava release includes an extremely simple visualization tool based on the Graphviz toolkit from AT&T research. To use it, make sure that the program 'dot' is installed and is in your path; if not, download Graphviz and install it. Also make sure that ghostview is in your path.
Then, you can visualize the architecture of any ArchJava component simply by running archview on the file (after taking off the .archj suffix). For example, to view the architecture of the Capitalize component in the architecture above, change to the examples directory and type:
archview capitalize/Capitalize
If your configuration is set up properly, a window displaying the architecture should pop up after a moment's delay. To see the architecture of the whole program (which includes Capitalize as a subcomponent) type:
archview capitalize/Main
As mentioned above, this tool is extremely primitive. We are currently extending the IDE described above to support visualization based on the AcmeStudio architecture environment.
The ArchJava compiler includes support for the AliasJava language, which allows developers to specify data sharing relationships between components in an architecture. To enable checking of alias annotations, run the compiler with the -A option, or use aliasj in place of archj. For all but the most trivial programs, the compiler will complain that files referenced in the standard library have no alias annotations. We hope to provide an annotated version of the standard library eventually, but for now, you can download the library source code from java.sun.com and annotate the relevant parts of the standard library yourself. Use the -aliasstdlib {classdir} option to direct the compiler to read the alias annotations from an annotated standard library code in the directory given. For example, to compile the pipeline architecture from the examples directory with alias annotation checking, use:
aliasj -aliasstdlib ~my_login/annotated_classes/ styles/Pipeline.archj
The examples from the OOPSLA '02 AliasJava paper can be found in examples/aliasing. To check the alias types, change to the examples directory and run:
aliasj aliasing/*.java
This release of the compiler includes an experimental release of alias annotation inference. To run inference on unannotated versions of the OOPSLA examples, change to the examples/inference directory and run:
infer -d output *.java
aliasj output/*.java
The -d option to the infer program instructs the inference engine to write the modified output files to the output directory. Other options include -R (infer annotations for all reachable source files) and -C (check the inferred annotations for correctness). There may be a few corner cases in which the inferred annotations are incorrect; we are continuing to work on the inference implementation.
Release 1.3.2 of the compiler has preliminary support for custom connectors in ArchJava. The directories examples/connector and examples/poemswap have examples of defining and using custom connectors. Note that support for custom connectors is still beta, and a couple of the examples in this directory may not work in their current form.