compiling jars into libraries w/ dependencies

stewart@neuron.com stewart@neuron.com
Wed May 2 20:27:00 GMT 2001


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. For example, given the following code:

class a
{
	public void a()
	{
		new b();
	}
}

class b
{
	public void b()
	{
		new c();
	}
}

class c
{
	public void c()
	{
		System.out.println("foo!");
	}
}

where a.java, b.java and c.java are compiled into classes and each is put
into it's own jar (a.jar, b.jar, c.jar), it is possible to compile c.jar
into a shared lib with:

 gcj -shared -o libmyc.so c.jar

but compiling b.jar with:

 gcj -shared -o libmyb.so b.jar

yields:

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

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

thanks!

stewart




More information about the Java mailing list