This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Compiling Generics
- From: Jacob Jennings <jdjennin at gmail dot com>
- To: java at gcc dot gnu dot org
- Date: Wed, 11 Mar 2009 12:48:48 -0500
- Subject: Compiling Generics
Hello, everyone. I just began using GCJ a short time ago, and I've
just run into a bit of a problem--most likely stemming from my lack of
knowledge about this compiler. In my Data Structures class, we program
a lot using generics, and I'd love to use GCJ, but when I attempt to
compile
public class ListNode<E> {
...
// blah blah, data members, constructors, methods, etc.
}
I get this error message:
ListNode.java:1: error: '{' expected.
public class ListNode<E> {
^
ListNode.java:1: confused by earlier errors, bailing out
Now when I compile this same code into bytecode with the Sun SDK, then
compile the bytecode into machine code using GCJ, the compilation
succeeds, and the resulting binary works perfectly fine. I would like
to get away from using Sun's SDK unless I'm doing GUI programming. Is
there a compile-time flag I'm missing or something? The command I'm
trying to execute is "gcj -o LinkedQueue --main=LinkedQueue
ListNode.java Queue.java LinkedQueue.java". Thank you.
Jacob D. Jennings