Re: trivial third party jar dependancy



On Thu, 27 Mar 2008 18:07:55 +0000, Mark Space wrote:


Are you just asking how to use an external jar?


Yes.

I made a jar of just that Calculations class and now want this "Foo"
class (just HelloWorldApp with a different name in a different package)
to use Calculations as an external jar. (If I simply import
thufir.math.Calculations everything runs fine, the problem is with using
an external jar.)



thufir@arrakis:~/jrake$
thufir@arrakis:~/jrake$ pwd
/home/thufir/jrake
thufir@arrakis:~/jrake$
thufir@arrakis:~/jrake$ java -jar lib/thufir/math/Calculations.jar
Calculations.main
thufir@arrakis:~/jrake$
thufir@arrakis:~/jrake$ cd src/
thufir@arrakis:~/jrake/src$
thufir@arrakis:~/jrake/src$ javac -d /home/thufir/jrake/prod/ -cp "/home/
thufir/jrake/lib/thufir/math/Calculations.jar" thufir/foo/Foo.java
thufir@arrakis:~/jrake/src$ cd ..
thufir@arrakis:~/jrake$
thufir@arrakis:~/jrake$ ll src/thufir/foo/Foo.java
-rw-r--r-- 1 thufir thufir 205 2008-03-27 16:30 src/thufir/foo/Foo.java
thufir@arrakis:~/jrake$
thufir@arrakis:~/jrake$ ll prod/thufir/foo/Foo.class
-rw-r--r-- 1 thufir thufir 722 2008-03-27 17:41 prod/thufir/foo/Foo.class
thufir@arrakis:~/jrake$
thufir@arrakis:~/jrake$ cd prod/
thufir@arrakis:~/jrake/prod$
thufir@arrakis:~/jrake/prod$ java -cp . thufir.foo.Foo


the fibonacci of 9 is: Exception in thread "main"
java.lang.NoClassDefFoundError: thufir/math/Calculations
at thufir.foo.Foo.main(Foo.java:7)
thufir@arrakis:~/jrake/prod$



thanks,

Thufir

.



Relevant Pages

  • Re: OT: It aint what it appears to be
    ... power tools and gadgets, "arrr, arrr". ... would not open its twin package. ... Once I even had to call my son-in-law to open a jar ... released the pressure and the lid turns off easily. ...
    (alt.support.mult-sclerosis)
  • Re: What classes are in a package? Functional requirement
    ... you can turn around and check the package for the ... > that correspond to the classpath. ... The JavaBeans spec allows you to package plugins into a jar and you know ... So the creator of the plug-in has to create a special jar file to indicate ...
    (comp.lang.java.programmer)
  • Re: What classes are in a package? Functional requirement
    ... you can turn around and check the package for the ... > that correspond to the classpath. ... The JavaBeans spec allows you to package plugins into a jar and you know ... So the creator of the plug-in has to create a special jar file to indicate ...
    (comp.lang.java.help)
  • Re: JAR! . . .What is it good for?. . .Absolutely nothing :-)
    ... It ended up pilot error :-( I looked through the JAR manifest and to my ... embarassment I found the EmpApplet and EmpClient classes but sadly no ... the same package don't need to import one another to be visible to one ... might trigger this behaviour in your applet viewer program, ...
    (comp.lang.java.programmer)
  • Re: how to set up a simple plugin mechanism
    ... First we need to assign a unique class name to every possible ... clossnames) These define the names of the members in the jar. ... qualified package names. ... name of any of these classes to a custom class loader, ...
    (comp.lang.java.help)