Subject: Re: Hw5

From: Archisman Rudra <[email-masked]>
Date: Sun, 5 Dec 1999 16:52:28 -0500 (EST)

Greg,
     Sorry, I thought I had replied to this earlier. I am also
forwarding it to the class mailing list because it is important
enough.

    To call the method mult.multiply from your code, all you really
need is to have the file mult.class in a place where the java
interpreter can see it. Usually this place is given in the CLASSPATH
environment variable. In some unix systems, for example, you will
write:
  setenv CLASSPATH directory-where-mult.class-can-be-found:${CLASSPATH}
(if using csh or tcsh) or else
  export CLASSPATH=directory:${CLASSPATH}

Under windows, the value of CLASSPATH should be similar, but I don't
know the syntac for specifying it.

  In your code, you should call the multiply in the normal way:

  product = mult.multiply(bignum1, bignum2);

  Also note that the CLASSPATH needs to be defined at the time you
invoke the java compiler, otherwise you will get some undefined
class error.

  If you can't get the CLASSPATH environment variable to work, you
could also include the source code of mult class from mult.java
(without the main method) in the same file, and compile. That
ought to work too.

  There are also methods to dynamically load classes from a given
file; these should also work. See the sun pages for further details.

  Note that the parameter bitLength is just a parameter you use
to generate the numbers of appropriate bit lengths, no need to
specify it to the routine.

-- Archi

> > Professor,
> > 
> > Do we have to change the code in mult.java for homework #5.  You say that
> > "For each bit length, we do a certain number of trials"...I am guessing
> > that we have to erase the code in mult.java which checks the correctness
> > of mult.java against the predefined BigInteger class (i.e. make
> > MaxTrials==1)...Also, should we allow mult.multiply(p1, p2) take in a
> > third parameter as in mult.multiply(p1, p2, numbits)?  If not, then how do
> > we call mult.multiply from within timing.java with the parameter numbits?
> > In other words, to run mult.java we normally type:
> > 
> > 			java mult <numbits> 
> > 
> > how do we call mult.class from timing.java with the parameter <numbits>.
> > 
> > THank you for your time!
> > 
> > --Greg
> > 
> > 
>