What's the difference of compile time libraries and run time libraries in java?

后端 未结 4 1174
庸人自扰
庸人自扰 2021-01-17 23:40

And what are the pro\'s con\'s of using either?

I actually saw it in Netbeans under Project Properties > Libraries for Java Applications. We have two tabs, one for c

4条回答
  •  清酒与你
    2021-01-18 00:19

    There is no such a thing as compile time libraries vs. runtime libraries

    Perhaps you're mixing some concepts.

    In Java the libraries to be used are statically validated at compile time and also validated at runtime.

    For instance if you want to use IterableMap specified in the Apache Collections library. The compiler validates "at compile time" you are invoking a method that exist in that class.

    But the compiler doesn't link or do much of anything with that library, you still need it at runtime. So, when your code executes, the Java runtime, searches for that class again, and invokes the method the compiler verified existed.

    And that what there is.

提交回复
热议问题