Avoiding same-package conflicts

Alex Buckley alex.buckley at oracle.com
Thu Oct 29 00:03:42 UTC 2015

Hi Karl,

Serious question: does your Java SE application expect that different 
versions of the same library are placed on the classpath in JDK 8?


On 10/28/2015 1:34 PM, Karl Sanders wrote:
> Hi,
> I'm trying out the JDK 9 EA with Jigsaw.
> I created two modules, A and B, which are required by module C.
> Modules A and B contain a non-exported package with the same name.
> After compiling each module separately I start module C and get a
> java.lang.reflect.LayerInstantiationException saying that modules A
> and B contain a package with the same name.
> In light of this behaviour I have two questions.
> - Is it correct to say that for a simple Java SE application to work
> with this configuration the only solution, in the realm of what will
> be provided with the GA version of JDK 9, is through the concept of
> layers of modules?
> - In that case will there be some sort of out-of-the box functionality
> to have this scenario work or will I have to write some non-trivial
> code to manage these layers?
> In other words, I have to use different versions of the same library
> in a Java SE application.
> Since Jigsaw is approaching I thought I could wait for it instead of
> learning and having to deal with OSGi.
> But from what I see by using only Jigsaw I won't be able to satisfy
> this requirement.
> At least not without writing some non-trivial code that I'm afraid is
> above my skill level.
> Cheers,
> Karl

More information about the jigsaw-dev mailing list