compiling to native: simple q

Bryce McKinlay bryce@waitaki.otago.ac.nz
Thu Apr 11 07:44:00 GMT 2002


Nic Ferrier wrote:

>I'm getting a whole bunch of errors that are to do with the
>dependancies of the class files.
>
>I have the CLASSPATH variable set to the jar files that are the
>dependancies for the paperclips classes, do I need to include them as
>compilation targets? (when I do that gcj segfaults).
>
>Should I be unpacking the jar files as classes and having gcj compile
>the whole thing?
>
>Should I be converting all the jar files into native libs and solving
>the depends that way?
>

Yes. You can't have native code that depends on bytecode (except for 
weak dependencies, ie reflection)

You could compile the .jar files into shared libraries:

gcj -shared foo.jar -o libfoo.so

And then link your application against them:

gcj my/classes/*.java --main=my.classes.main -o myapp libfoo.so

regards

Bryce.




More information about the Java mailing list