- To: mathgroup at smc.vnet.net
- Subject: [mg23704] Re: JLink
- From: tgayley at wolfram.com (Todd Gayley)
- Date: Mon, 29 May 2000 22:05:39 -0400 (EDT)
- Organization: Wolfram Research, Inc.
- References: <firstname.lastname@example.org>
- Sender: owner-wri-mathgroup at wolfram.com
On 29 May 2000 12:37:33 -0400, Megan Roberts <megan at tarms.com> 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, >re-created >a new jar and started Mathematica again. The problem is when I type >the >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 >new >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 >existed. >*I opened a new Notebook and typed the commands from scratch, but to >no >avail. > >I would like to know how Mathematica is referencing the old method >name >even though it doesn't exist anymore. > >Thanks in advance for you help, > >Megan Megan, 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. --Todd