compiling jars into libraries w/ dependencies

Bryce McKinlay bryce@waitaki.otago.ac.nz
Thu May 3 06:40:00 GMT 2001


stewart@neuron.com wrote:

> I'm trying to compile jars into shared libraries which contain dependencies
> on other jars. I can compile a jar with no external dependencies, but even I
> I compile the jar which is depended on into a shared lib, I cannot seem to
> get it to be recognized.

>  b.java: In class `b':
>  b.java: In method `b()':
>  b.java:5: Cannot find file for class c.

Even if you are linking against a shared library, you must have either source
or a class file for "c" available at compile time. So, this particular error is
happening because c.java or c.class is not visible to the compiler.

> what magic command-line do I pass to the second gcj to get it to compile?

-L. -lmyc

"-L." tells the linker to look in the current directory for things to link.
"-lmyc" tells it to link (in this case, create a dynamic link) against
libmyb.so.

regards

  [ bryce ]




More information about the Java mailing list