Skip to content

JAR files are statically linked or dynamically linked


|In Java, the code from external library jar is not compiled into your java classes. In other words, you don’t compile the code from JAR files into your own source code. The classes are loaded from your the other library by the name of the package or by the import statement. This is more similar to Dynamic linking rather than static linking.

This the reason the external jar files used in your own source code are thought to be off dynamic linking. Since the classes are loaded into JVM as references, all the imports are dynamically linked rather than statically linked!

GPLv2 and GPLv3 apply for both statically and dynamically linked libraries with your own source code. The reason here is your source code is considered to be a derivate work of GPLv2 or GPLv3 even if it’s statically linked or dynamically linked! So if you are using library with any of the GPLv2 or GPLv3 license and if your are distributing your application, then your actual custom source code must be published under GPLv2 or GPLv3 license!