When importing a java library class from jar, is this considered static linking? or dynamic?

If you are looking for information about applying various software licenses on Java programs, then searching Google for <license name> Java usually results in a useful hit.

E.g for LGPL Java, this is the first hit. In this particular case, the bottom line is:

Applications which link to LGPL libraries need not be released under the LGPL. Applications need only follow the requirements in section 6 of the LGPL: allow new versions of the library to be linked with the application; and allow reverse engineering to debug this.

I.e. as long as the library is provided in a separate JAR file that can be easily replaced, LGPL allows it.

PS: I Am Not A Lawyer! If in doubt, consult one. As a matter of fact, depending on where you live, it might make sense to consult one regardless if you are in doubt or not.


Static vs dynamic as in C++ doesn't exist in Java. All class get loaded into JVM as they are referenced, so you'd want to think that all imports (this includes reflections) in Java are dynamic.

And that .* is bad because of the naming and class discovery conflicts that it might incur, nothing to do with class referencing.


Well, you don't compile the code from library into your java classes. Your compiled classes refere the classes from other library by name. When need, the class is loaded by class loader. It's more similar to dynamic linking.

From licencing point of view - f.g. LGPL licence, it should be considered as dynamic linking. I've never heard of any law proceeding in that case (though I've searched for it), but it is high propable, I'm looking forward to it, because many developers are a bit anxious about it.