MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: JLink

  • To: mathgroup at
  • Subject: [mg23704] Re: JLink
  • From: tgayley at (Todd Gayley)
  • Date: Mon, 29 May 2000 22:05:39 -0400 (EDT)
  • Organization: Wolfram Research, Inc.
  • References: <8gu6cd$>
  • Sender: owner-wri-mathgroup at

On 29 May 2000 12:37:33 -0400, Megan Roberts <megan at> wrote:

>I am using Mathematica 4 installed on a Windows NT 4 platform. I
>downloaded J/Link from your website and have installed it. I have
>created a jar with the relevant class files and put this in my system
>classpath. One of my method names, discount_rate, caused problems
>because of the under score. I then changed this method name,
>a new jar and started Mathematica again. The problem is when I type
>Methods[myObject] command I still get discount_rate (even though this
>method name is not in any of the class files in the jar).
>I have tried the following things to remedy this:
>* I recreated the jar, giving it a new name. I then referred to this
>jar in my classpath and deleted the reference to the old one. I
>restarted Mathematica and still got discount_rate() returned in my
>method list.
>* I shutdown (and restarted!) my computer, but still the problem
>*I opened a new Notebook and typed the commands from scratch, but to
>I would like to know how Mathematica is referencing the old method
>even though it doesn't exist anymore.
>Thanks in advance for you help,


You must have the old class in your CLASSPATH somewhere. The old version is being found
and loaded before the new version. Perhaps your CLASSPATH references the directory in
which the old .class file exists. One way or the other, it is certain that an old copy of
the class is lying around somewhere and being found.

By the way, J/Link can handle names with underscores in them. Just replace the underscore
with a U. For example:

obj at discountUrate[]

J/Link only requires the underscore-to-U replacement when names are used as symbols
(because underscores are not legal characters in Mathematica symbol names). In places
where names appear as strings, you use the underscore. Thus, the output of Methods, which
is a list of strings, shows names with underscores in them, and when you use any J/Link
functions that take Java names as strings, such as LoadClass and JavaNew, you leave the
underscore. This is discussed in section 1.1.6 of the User Guide.


  • Prev by Date: InputAutoReplacements alteratives?
  • Next by Date: Re: programming DeleteRepetitions
  • Previous by thread: JLink
  • Next by thread: Re: parametricplot