## What is it?

cowjac is an experimental AOT Java compiler. It works by compiling Java into reasonably portable C++, and then compiling the C++.

## How does it work?

It's intended for use on devices which don't support or allow running a JVM. cowjac produces completely standalone binaries.

Performance is adequate (some very rough-and-ready benchmarks on my machine show that, with all the optimisation turned on, it runs at about a quarter the speed of Hotspot Server... which is still very fast). Footprint is not brilliant; right now every binary gets most of the Apache Harmony standard library compiled into it, which means that they're about 2MB minimum.

Reflection is not supported. There's some basic and largely broken support for Class objects, and just enough of java.lang.reflect to make System.arraycopy work, but that's it. There is currently no built-in garbage collector or threading (but both are planned; all the hooks are in place for a simple and portable mark/sweep garbage collector, but it's not done yet). However, linking against libgc works just fine.

The current status of cowjac is that it will run command-line applications well enough to do benchmarks.

cowjac uses the Soot Java analysis framework to do the heavy lifting. It also contains a severely truncated version of the Apache Harmony standard library.

## How do I get it?

Currently cowjac is still in the mad hacking stage. You'll need to get it from github.

Cowjac's github repository

Send me pull requests!

To build cowjac, you'll need Java, Scala, and ant.

[edit build.xml and change the two scala paths at the top]
ant run
make
./cowjac


## How do I use it?

There's currently an incredibly basic test framework to make it all go. When you do ant run, the contents of library/src will be compiled into the cowjacOutput directory; doing make (with as much -j as you've got, there are a lot of files) will compile all this into a binary which you can run.

library/src contains a completely standalone Java environment. If it's not in there, you don't get to use it. There's a reasonable amount, but some of the more exotic stuff are just stubs and some is just missing (Calendar, DateTime, NumberFormat, Formatter... *shudder*). Using unimplemented features will either produce Java compilation errors, runtime exceptions or assertion failures, or just crash. If you feel like you want to add stuff, let me know and I'll give you repository access.

### Is there any support?

None!

But I have been prodded into writing a few notes:

If you have any questions, email me, David Given, at dg@cowlark.com, or file a github issue. If there's any interest I'll set up a mailing list.