Perhaps you are going about this the wrong way. What you really want
to do here is wrap up your classfiles in some way that they can
be loaded by the JVM without putting them on the filesystem.
Perhaps what you need to do here is write your own classloader
like the TclClassLoader.

As for why the java::defineclass command is returning null, perhaps
you should fire up ddd with the java debug option inside Jacl and
see if you can figure out where things are going wrong. There is
already a rule in the Jacl makefile that does this for you, it is
called "make ddd".

Mo Dejong
Cygnus Solutions


On Wed, 5 Jan 2000, Vince Darley wrote:

> > -----Original Message-----
> > From: Mo DeJong [mailto:[EMAIL PROTECTED]]
> > 
> > Off the top of my head, I would be willing to bet that the problem
> > you are having is because a class you want to define depends on
> > another class that can not be found.
> > 
> > Like so:
> > 
> > class A {
> >   B b = new B();
> > }
> > 
> > class B {
> > }
> > 
> > Try loading B first, and then A. If that works but simply loading A
> > does not, then the lack of the B class is the problem.
> 
> This doesn't seem to be the entire problem (I'm sure it's part of the
> problem, though).  For instance the following test class won't load:
> 
> package medical;
> import java.util.Random;
> 
> public class Tests {
> 
>     double f[];
>     double min;
>     double max;
> 
>     public Tests(double min, double max) {
>       this.min = min;
>       this.max = max;
>     }
>     
>     void set(double[] value) {
>       f = new double[value.length];
>       for (int i=0; i<f.length; i++){
>           f[i] = value[i];
>           if(value[i] < 0) {
>               throw new RuntimeException("Probabilities must be
> positive!");
>           }
>       }
>     }
> 
> }
> 
> If I delete the entire 'set' method then it will load.  Otherwise, I get a
> java0x0 null object back from the java::defineclass command.
> 
> However: from what you say below it seems as if java::defineclass cannot be
> used with classes which reference each other ( class A { B b; ... } class B
> { A a; ...} ).  That will probably be problematic for me in any case.  I
> guess this is a limitation of defineclass?
> 
> cheers,
> 
> Vince

----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
An archive is available at http://www.mail-archive.com/tcljava@scriptics.com

Reply via email to