Re: trivial third party jar dependancy
Mark Space wrote:
Are you just asking how to use an external jar? I didn't include a
third party jar, I just used your thufir.math.Calculations class to make
a "third party" file then ran it like I would if it were external:
Brenden@Homer ~/Dev/misc/thufirTest
$ java -cp "build2;dist/fibonacci.jar" thufir.sun.hello.HelloWorldApp
Hello World!
the fibonacci of 9 is: 34
Brenden@Homer ~/Dev/misc/thufirTest
$ ls build2/thufir/sun/hello/HelloWorldApp.class
build2/thufir/sun/hello/HelloWorldApp.class
Brenden@Homer ~/Dev/misc/thufirTest
$ ls dist/fibonacci.jar
dist/fibonacci.jar
Brenden@Homer ~/Dev/misc/thufirTest
$ jar -tf dist/fibonacci.jar
META-INF/
META-INF/MANIFEST.MF
thufir/
thufir/math/
thufir/math/Calculations.class
The OP may have been asking how to include library dependencies when executing
java with the "-jar" option, in which case it would ignore the -cp option.
For that scenario one would deploy the libraries with the application JAR and
include them in the application JAR's manifest's "Class-Path" attribute.
<http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#Main Attributes>
--
Lew