Basically two questions:
1) Where should my third party JARs go? Currently I’m immorally putting them in my application’s package, which is immoral e.g. because the third party libs are lower level and should be able to be depended on by all my applications.
2) Where should classpath be set? Tutorials I’ve seen make it sound like it should be a global variable, but I don’t know this because it needs to be project-dependent, i.e. project X needs libraries L and M but project Y needs libraries M and N. Currently I’m just creating a “cp” file for each application but I was wondering if there is a more canonical style.Z
Jars you put into
don’t need to be specified in the classpath. So this is useful for libraries you use often like apache-commons for eample.
Rarely used libraries are better called with the classpath.
Setting the classpath depends on your usage, and whether you work on a single user machine, whether it is a client or a server. Many Java apps are made for servers, where you happen to have only one classpath at all.