This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: questions on gcj and javac compiled jar file


>>>>> "Jianming" == Jianming Ye <jye@bbn.com> writes:

Jianming> gcj --main=HelloWorld -I./test HelloWorld.java

Jianming> /tmp/ccIp2zpe.o(.text+0x1d): In function
Jianming> `HelloWorld::main(JArray<java::lang::String*>*)':
Jianming> : undefined reference to `test::Tester::class$'

If you compile this way, you have to think of building your java
program as if you were building a C or C++ program.  So when you
compile a given class, you must also compile all the dependencies of
that class, and link them all together.

The traditional way to do this is to compile each .java file to a
separate .o, then link all the .o files together to make your
executable.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]