Daily Archive for September 24th, 2006

Most used commands

pravi@savannah:~$ history|awk ‘{print $2}’|awk ‘BEGIN {FS=”|”} {print $1}’|sort|uniq -c|sort -r|head -10
9 qemu
91 cd
8 free
8 du
87 ls
7 export
7 cat
6 ssh
6 pdftohtml
5 man

Thanks Karthik for that tip.

Java programming with gcj

How to compile and run java programs using GCJ ?

$ gcj -C hello.java

is similar to javac hello.java and it creates a class file hello.class

$ gij hello

is similar to java as it executes bytecode in hello.class

what gcj offers that is not available with reguar jdk is support for creating binaries

$ gcj hello.java --main=hello

or if you already have the class file

$ gcj hello.class --main=hello

will create a binary file a.out and you can execute it using

$ ./a.out

it is similar to compiling with gcc and you can specify a different output file with -o option

$ gcj hello.java --main=hello -o hello
$ ./hello

More information on gcj see http://gcc.gnu.org/java/