gcc is the "c" compiler. It will compile only C code. g++ is the C++ compiler, which will compile only C++ code. That said, gcj is the one that can compile Java code.
You are trying to compile java code with the GNU C compiler. It won't work. Assuming that you have gcj installed, the syntax is exactly (or almost) as gcc to compile and link. E,g:
Code:
gcj -c -g -O Hello.java
That will compile your code into a Hello.o (object file) but not link. To link it, use the command:
Code:
gcj --main=Hello -o Hello Hello.o
it's exactly like compiling a C program, with exception that you have to tell the compiler your main java class (in this case, Hello).
However, if you want to learn java, I'd recommend you getting into Sun's homepage and grab the Java SDK for Linux. There're binaries there for Linux, Windows and Solaris and they are equally easy to install.
Besides, gcj cannot yet compile graphical interfaces as Swing classes in Java. All the rest works fairly well though.
Good luck!