Author

Christopher Marshall (christopherlmarshall@yahoo.com)

Raw Notes on gcj

# here how to compile hellow.java to the elf executable "hellow"
gcj --main=hellow -o hellow hellow.java

# say you have 
   export CLASSPATH=.

   # in one fell swoop:
   gcj --main=pkgtest -o pkgtest pkgtest.java A/B.java

   # compile one file at a time, then link
   gcj -c pkgtest.java
   gcj -c A/B.java
   gcj --main=pkgtest -o pkgtest pkgtest.o B.o

   # compile one file at a time, then link, w/o CLASSPATH environment variable
   gcj --classpath=. -c pkgtest.java
   gcj --classpath=. -c A/B.java
   gcj --main=pkgtest -o pkgtest pkgtest.o B.o

   # compile to pkgtest.class instead of to pkgtest.o
   gcj -C pkgtest
   gij pkgtest


# achieving the effect of "java -Xmx1m" (where you limit the heap size
# to 1m) is not as easy as invoking the executable with "ulimit -v"
# libgcj won't throw an out of heap exception properly when it runs out of stack
# one workaround is to define the environment variable GC_MAXIMUM_HEAP_SIZE before
# invoking a gcj executable.
   export GC_MAXIMUM_HEAP_SIZE=10m
   ./gcj_program
# or, using gij
   gij -mx <heap limit in bytes> gcj_class_name

# when running class files with gij, use the -mx option.
gij -mx=64m

hopeless_linux: RawNotes/gcj (last modified 2007-07-01 16:01:00)