questions on gcj and javac compiled jar file

Jianming Ye jye@bbn.com
Tue Aug 23 13:51:00 GMT 2005


Hi Tom:
Thanks for the info. This is actually what I thought . However, even 
with a very simple program I ran into some problems.
In this case I have a HelloWorld main class in the default package, and 
a Tester class in the test package. The HelloWorld class uses the Tester 
to print a hello message. I precompiled the test.Tester and the 
Tester.class is in the test directory . If I treat both classes as src 
files, then I am ok. Only when I try to put Tester.class in the 
classpath instead of as src, then I am getting errors. The command I 
ran is:
gcj --main=HelloWorld -I./test HelloWorld.java
And I get the following:
/tmp/ccIp2zpe.o(.text+0x1d): In function 
`HelloWorld::main(JArray<java::lang::String*>*)':
: undefined reference to `test::Tester::class$'
/tmp/ccIp2zpe.o(.text+0x30): In function 
`HelloWorld::main(JArray<java::lang::String*>*)':
: undefined reference to `test::Tester::Tester()'
collect2: ld returned 1 exit status
What did I do wrong here? Isn't the -I or --classpath suppose to point 
to the jar or directory with .class files which the main class 
reference? I'd appreciate your help!
-Jianming
Tom Tromey wrote:
>>>>>>"Jianming" == Jianming Ye <jye@bbn.com> writes:
>>>>>>>>>>>>>>Jianming> 1) If I have a jar file compiled wirh javac (JDK1.4.2) ,
>Jianming> could I use it directly with gcj? Do I need to recompile
>Jianming> the jar file with gcj?
>>Provided it does not have any dependencies on core classes which gcj
>does not provide (including sun.* and com.sun.* classes, which many
>projects seem to use), it will work fine.
>>You can either use the jar directly with gij, or you can compile it
>with gcj. The manual ought to cover both of these cases.
>>Jianming> 2) Anyboy has experience using gcj with JacORB?
>>I believe we've been using jacorb, compiled with gcj, as part of our
>jonas build. In fact I think it is in Fedora Core (rawhide maybe, I
>forget).
>>Tom
>>>


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /