Define what you mean by "compile"...
If you want to compile to byte code (usable on other platforms...like making jars or class files), then you need to run javac. If you want to compile to native machine code for openbsd, then gcj would be the way to go. GCJ tends to run faster than byte-compiled programs, but it tends to not support as much of the java language as the javac compiler does. As a bonus, though, GCJ compiled programs can utilize both gcj compiled and byte compiled java, which is nice.