| [news.eclipse.newcomer] Re: Help with jar export and external library |
Eric Rizzo wrote:Paul Rubin wrote:
I don't suppose anybody has found a better way to get around Java ignoring -cp when running a jar?
I was not aware of that side-effect of using java "-jar" but in any case you don't have to resort to deploying an exploded JAR (.class files). You can still ship a JAR and a batch file, just instead of using "java -jar ..." you include your JAR on the -cp arg to java.exe or javaw.exe. The -jar shorthand is just a convenience method, you can ignore it when it doesn't meet your needs.
Simple, elegant, works like a charm. Thanks! My app doesn't require much in the way of launching (I wrote a one-line batch file to launch it). I had just assumed (incorrectly) that if you launched a class rather than a jar, the class containing the main method had to reside in the file system (rather than in an archive). Wouldn't have thought to try this without the tip.
Eric