An easy way to reinstantiate an mxj object ?

Jun 11, 2008 at 4:16pm

An easy way to reinstantiate an mxj object ?

Hi,

i was wondering if someone found a particular alternative to the “clic-three-times-on-the-object–erase-one-letter–retype-the-letter–clic-in-the-patch-window” machinery each time we recompile the java code ?

thanks,
Alexandre

#38341
Jun 11, 2008 at 8:27pm

I think the easiest way is to delete the object, then undo.

#133455
Jun 12, 2008 at 12:04pm

thanks,

i even didn’t think about that..

#133456
Dec 27, 2009 at 1:28pm

Hi,
I’m patching with max 5.1.
Need to set
mxj.classloader.fromdisk 1 in the max.java.config.txt file

In the java doc, it says that we can send a zap message to reinstantiate the class file but it doesn’t do anything . I’ve also tried with _zap, and nothing.
Did anyone got the zap message to work or found a way so the mxj automatically loads from the disk?

#133457
Dec 27, 2009 at 2:09pm

Re,
I made more tests,
in fact, the delete and undo trick works even if fromdisk is set to 0.
But for me it only works if I send a zap message then delete and then undo.
Not very pragmatic.

I wish there was a “autowtch” like in js but for mxj

#133458
Jan 12, 2010 at 6:05pm

re, i found a trick, i wrote a js that delete and build the mxj object in one click.

#133459
Jan 13, 2010 at 9:51pm

I had the same problem (running on a Windows XP). Once I found the zap command it worked for me.

A good solution for checking if you have the latest version is to let your java object output the compile date when it’s instantiated.

My java MaxObject’s always call a method called postversion() on instantiation. This method only works if you compile to classes and not to jars.


public void postversion() {
String VERSION = "";
try {
Date modDate = new Date(getClass().getResource(getClass().getSimpleName()+".class").openConnection().getLastModified());<
VERSION = "modified "+modDate;
} catch (IOException e) {
e.printStackTrace();
}
post(getClass()+", VERSION "+VERSION);
}

#133460
Mar 2, 2010 at 7:06pm

> “But for me it only works if I send a zap message then delete and then undo.”

the java-doc tells the zap msg is only interesting when using more than one mxj object of the same class. I do this rather rarely. if you only have one mxj of your class in a patch, you don’t need the zap message. I never used it and the “delete-then-undo” works for me.

But i still dream about a “reinstantiate” message feature in mxj.

#133461

You must be logged in to reply to this topic.