NoClassDefFoundError when trying out [mxj]...

    Feb 09 2013 | 11:16 pm
    So this is sort of driving me crazy, and apologies if it's something really stupid.
    I've decided to play around with [mxj] and to that purpose, wanted to make a decimal to hexadecimal coverter. I have a HexUtil class that has a static decToHex method that already does the job nicely, so I figured it would be perfect to test [mxj].
    So my first mxj class is in /Applications/Max6/Cycling '74/classes/stsmx/util/ and the source looks like this:
    import sts.util.HexUtil;
    import com.cycling74.max.*;
    public class DecToHex extends MaxObject {
        DecToHex() {
            declareInlets(new int[] { DataTypes.ALL });
            declareOutlets(new int[] { DataTypes.ALL });
    [...some more blabla...]
    public void inlet(int i) {
    It compiles fine, and the constructor is called. But as soon as I try to send an int to the shiny new object, Max gives me a NoClassDefFoundError: sts/util/HexUtil
    I can use my HexUtil class in any other class just fine, so I'm lost.

    • Feb 10 2013 | 8:56 am
      What does the package declaration for your HexUtil class look like?
    • Feb 10 2013 | 9:01 am
      Wait... you've declared package stx but put it in directory stsmx ?
    • Feb 10 2013 | 11:00 am
      Nick: Not quite. HexUtil is a general-purpose class situated entirely elsewhere, it's just that the subdirectory names are similar. It lives in /Users/stas/java/sts/util. The package declaration is
      package sts.util;
      DecToHex on the other hand, is in the Cycling '74/java/classes/stsmx/util subdirectory of the Max6 application directory, which I've done in order for [mxj] to find it (which is does). It's package declaration (which I omitted above) is
      package stsmx.util;
      It's sort of weird that no error is caught by the compiler and instead occurs at runtime.
    • Feb 10 2013 | 11:17 am
      Ah, OK: sorry, I misread that. So I guess MXJ can't find HexUtil. You'll either have to put that class file into Cycling '74/classes as well (with the correct directory structure) or modify to include the root directory where it can be found.
      I don't know how you're compiling, but HexUtil must be in the compiler's classpath - so there is no compile-time error - but it's not in Max's classpath at runtime.
    • Feb 10 2013 | 12:30 pm
      Thanks Nick! I edited and it worked. I need to read up on the way Max handles the classpath.
    • Feb 10 2013 | 3:16 pm
      There's some cleverness with extending the classpath when actually reading patcher files, but otherwise it's all pretty obvious.
      For managing, you might be interested in trying Topherizer:
    • Mar 17 2013 | 11:48 am
      Nick, some good and bad news the last status: legend: w7 M(stands for Max; J->Java, y->ok n->no) (y) Java works(?) but in the Max-Window appears class errors w7: M4.6.3 J y, M6.0.8 J y osx-10.6.8: M4.6.3 J y, M6.0.8 J n xp home sp3:M4.6.3 J y, M6.0.8 J y osx-10.5.8: M4.6.3 J (y), M6.0.8 J(y)
      but at 1st this: in my opinion, these c74_people should revise the "writing externals for java.pdf" immediately an important point is, to advice their users that the classes_paths should be include in filepreferences otherwise Max 6 can't recognize the class_paths and fails with "unable to create JVM" right?
      in my next reply I'll send you here the last problem_candidates (mxjpreferences.xml, in Max v.6 under osx 10.6.8 (SL) and the output by the Max_window
      btw, I would be glad that somebody would create some tutorials (not only about mxj mxj~) in german im Deutschen ist manches einfach klarer und plausibler beschrieben
      thanks for help and solutions
    • Mar 17 2013 | 1:40 pm
      for information: my apologies is it sounds a bit rough, because of my broken english