Title: Re: [Tcl Java] using java::defineclass

> -----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

Reply via email to