Alex Rivera | Logout

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

Asked 2011-01-26T14:22:20.500
31

say I have jcifs-1.3.14.jar in my lib folder, and I have a class that is importing from the library and uses the classes like:

import jcifs.smb.*;
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(domain, 
                                                                 user, 
                                                                 pass);
SmbFile file = new SmbFile(path, auth);
// do some operations with the file here

When using the library in this fashion is it considered to be: A) Static Linking OR B) Dynamic Linking OR C) something else?

Edit
Report

1 Answer

17

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.

answered 2011-01-26T14:31:23.560

Your Answer