Re: trivial third party jar dependancy



Mark Space wrote:
Lew wrote:
Mark Space wrote:
With java -jar, you have to set the Class-Path property. For whatever reason, java -jar ignores any classpath you specify on the command line. This is very counter intuitive to me, but there it is.

There is a rationale for it. JARs are how you package your application to run in a foreign environment (the user's). You have no control over the user's CLASSPATH or if they use the -cp option correctly. To get

For a savvy user, I'd like to see the -cp option used. It's a way of

Then they simply invoke the main class without the -jar option. The choice is there.

making sure stuff is still accessible when an old .jar assumes a library in one location which have moved to another. It's a long term

You're supposed to bundle the library /with/ the application. If the user moves it after that, well, what can you do? They've just forced themselves not to use the -jar option, but they really have no excuse for doing that, do they?

Assuming a library location on a user system where you didn't install it with the application is as risky as depending on them to supply the correct classpath.

maintenance issue. For that matter, the CLASSPATH in the environment should work the same way. Environment namespace pollution bugs me, but it's still useful.

Yes, it is a long-term maintenance issue. That's why you don't leave it up to the user, but make them use the -jar option.

--
Lew
.