gcj does not compile Hello World

Bjoern Olav Ringstad bjornor@stud.cs.uit.no
Sat Jun 8 16:06:00 GMT 2002


Hi

When you compile a java program with gcj you have to create a .class file with
gcc -C HelloWorld.java (capital c) and run it with a JVM.
If you need to, you can create a native executable with gcj, then you have to specify
the class that holds the main method like this: gcj -o HelloWorld HelloWorld.java --main=MyClass

--

Bjørn Olav Ringstad (bjornor@stud.cs.uit.no)


> On Fri, 7 Jun 2002 wadedl@gat.com wrote:
> 
> > gaws20> gcj -o HelloWorld HelloWorld.java
> > /usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.1/crt1.o: In function `.nope':
> > /usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.6/3.1/crt1.o(.text+0x5c): undefined reference to `main'
> > collect2: ld returned 1 exit status



More information about the Gcc-help mailing list