Trouble getting MXJ to work.

Feb 25, 2012 at 2:15pm

Trouble getting MXJ to work.

I’m trying to get this piece of Java to load into MXJ – it compiles fine, but when I go to make an [mxj] object to host it, I get java.lang.NoClassDefFoundError: meansink (wrong name: list/Meansink). Any idea why? Why does my classes disappear? it’s still in the same spot as all the other java things – and yes I’ve restarted Max in the hopes of restarting the max JVM, no luck.

–java code–

package list;
import com.cycling74.max.*;

public class Meansink extends ListProcessor {

int howMany = 1;
float[] theList;

Meansink(Atom[] a) {
if (a.length >0)
howMany = a[0].toInt();
howMany = 100;

public void loadbang(){

protected void input(int idx, Atom[] a) {
switch (idx) {
case 0: streamAlong(a); break;
case 1: setHowMany(a); break;

public void setHowMany(Atom[] a) {
howMany = a[0].toInt();

public void setLen(int i){

theList = new float[i];

public void streamAlong(Atom[] a) {

for( int i = 1; i

theList[i] = theList[i-1];
theList[0] = a[0].toFloat();
setOutput(0, Atom.newAtom(theList));


–/java code/–


Feb 25, 2012 at 2:17pm

Figure I might as well attach a file.

Feb 25, 2012 at 2:29pm

Hi MuShoo,

mxj classes must extend from MaxObject.


Feb 25, 2012 at 10:41pm

except for that all the mxj list.* objects extend from ListProcessor. Which is an extension of MaxObject. So yes, I am extending from MaxObject.

Feb 25, 2012 at 11:04pm

OK durr.

Figured it out – I’m using ListProcessor – which is an extension of MaxObject, from within the list package – so I have to instantiate as list.Meansink.


Feb 28, 2012 at 2:25pm

Another way to say this is: you placed the class in the list package, therefore it has to be instantiated with the full path, list.Meansink. This would apply to any Java class. If you simply remove the package statement at the top of your code you’ll be able to instantiate the class as you were trying to.


You must be logged in to reply to this topic.