The_Unknown
The_Unknown

Reputation: 1048

Use a jar included in a jar

I'm developing a little framework which depends on a library (jar file). I managed to include that dependency in the final framework jar file. But when I include this framework jar (which includes the other library) I can use the framework's classes but I cannot use the classes of the dependency library included in the framework jar.

How can I manage to solve this? And is it a good practice to include a third party library in my framework (even it's under GPL license)? I just want to reduce the work the framework user (developer) has to do.

Upvotes: 0

Views: 155

Answers (1)

Michael Borgwardt
Michael Borgwardt

Reputation: 346476

How can I manage to solve this?

Nesting JARs is possible if you use a special classloader such as provided by OneJar, but it leads to rather long startup times and of course adds another dependency and complication.

Managing a classpath with mulitiple dependencies in JAR files is something all Java developers are familiar with. I see no value in trying to avoid it.

And is it a good practice to include a third party library in my framework (even it's under GPL license)?

That depends - if your framework is not also GPL, you're in violation of the license and could be sued. And it doesn't matter whether you actually include the GPL jar or not.

Upvotes: 1

Related Questions