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

后端 未结 4 1176
庸人自扰
庸人自扰 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:22

    The UI and terminology of the Libraries properties dialog is pretty confusing.

    The Help button on that dialog will give you a fair bit of info.

    The Compile-time library list may be a subset of the Run-time library list.

    Consider this situation...

    You have source code that imports classes from on a library 'widgets.jar'. The class files in widgets.jar reference symbols from the jar file 'xml.jar'. If your source code does not import classes from xml.jar, you could define the Compile-time libraries list to contain just widgets.jar.

    When you try to run your project, you will probably need to include xml.jar in the Run-time libraries list to prevent ClassNotFoundException's.

提交回复
热议问题