probably quite usual jar-question

Oct 26, 2011 at 12:00am

probably quite usual jar-question

Hello,
i’m just starting to develop Max-objects with java/eclipse.

There is quite a useful tutorial how to do it:

http://compusition.com/web/articles/maxmsp-eclipse

Different from the way described in the tutorial, i’d prefer to export my Max-class-libraries as jar-files to the …/Max5/Cycling ’74/java/lib folder.

It works fine, but everytime i change something in my class-library and export it again, i have to restart Max – otherwise the changes have no effect. (delete and undo of the mxj-object does not help)

Is it possible to force Max to “refresh” the Classpath, to reload the libraries? (don’t know if the terms are right but i hope you know what i mean)

thanks in advance

nossek

#59549
Oct 26, 2011 at 9:06am

Have you tried clicking on “; max db.reset” in a message box? This will refresh the search path/file browser and might help.

#214320
Oct 26, 2011 at 11:09am

Java doesn’t use the Max search path (well, not much – it extends the classpath only when loading patchers). If you want JAR files to be dynamically reloadable you’ll need to put them into the Java dynamic search path, as specified in max.java.config.txt in the Cycling ’74/java folder.

#214321
Oct 28, 2011 at 9:16pm

Thanks Luke and Nick.

“; max db.reset” has no effect.

i tried what Nick suggested but it did not work:

I put my jars into the lib-folder inside the java-folder (wrong idea?) and wrote inside the “max.java.config.txt”:
max.dynamic.jar.dir Macintosh HD:/Applications/Max5/Cycling ’74/java/lib

what’s wrong here?

Well, i decided to set the “max.dynamic.class.dir” to my Eclipse-Project during the developement. I can export the library as a jar later…

#214322
Oct 30, 2011 at 11:26am

I put my jars into the lib-folder inside the java-folder (wrong idea?) and wrote inside the “max.java.config.txt”:
max.dynamic.jar.dir Macintosh HD:/Applications/Max5/Cycling ’74/java/lib

the max.java.config.txt file is expecting a unix style filepath (on OS X at least). So I think the correct thing for you to put in there would be:
max.dynamic.jar.dir /Applications/Max5/Cycling '74/java/lib

That being said, I believe Max checks that folder for jars automatically, so I don’t know if you even need to add that to your max.java.config.txt (that seems to be how it works on my machine). Not that I’m claiming i know what, but is it possible there is something wrong with the way you are building the jar? Or instantiating your class in the mxj? Incase you are not aware, if your class is in a package, you need to put the whole package/class name into the mxj box, not just the class name (e.g. mxj outer.inner.myclass vs mxj myclass).

Something I would try to test if your jar is getting loaded in Max is to put it in /Applications/Max5/Cycling '74/java/lib and then open Max and make an mxj quickie to start the JVM and look into the Max window to see if your jar got loaded.

#214323
Oct 30, 2011 at 12:06pm

I have a feeling that dynamic JAR loading is slightly broken, based on my attempts to use it (admittedly some time ago).

In any case, I’m not sure I understand why you want to be able to load JARs dynamically. If you’re doing incremental Java development you might as well just point at a tree of class files, and bundle up JARs when the code is more stable.

#214324

You must be logged in to reply to this topic.