Very simple .class file that works only in Windows


    Nov 10 2006 | 10:54 pm
    Dear all, I wrote an MXJ really simple class that just creates a new folder on the hardisk.
    I wrote and compiled it on Windows XP, but it does'nt work on Mac OSX.
    Here there is the java file:
    and here the .class:
    This is the simple code:
    import com.cycling74.max.*;
    import java.io.File;
    public class BmakeFolder extends MaxObject {
    String path, name = "folder";
    public BmakeFolder (Atom[] args)
    {
    createInfoOutlet(false);
    declareInlets(new int[]{DataTypes.ALL});
    declareOutlets(new int[]{DataTypes.ALL});
    }
    public void anything(String msg, Atom[] args)
    {
    File f = new File (msg);
    f.mkdir();
    }
    }
    Thank you very much.
    Bruno
    -------------------------------------------------
    - http://www.brunozamborlin.com -
    -------------------------------------------------

    • Nov 10 2006 | 11:11 pm
      Just another question: if I recompile this class on Mac, it works.
      But if I send it a message with a full macintosh path, like "iBook:/Users/iBook/Desktop/test", that is the path that goes out from "thispatcher" object, it doesn't create the folder.
      However, if I give it a path like "/Users/iBook/Desktop/test", that is without the partition name, it works fine.
      On Windows it always works good.
      So the questions would be two:
      1-Why I have to re-compile this class, if Java is multiplatform?
      2-How can I remove the "partition name" from the path, but just on a macintosh platform?
      Thank you very much.
      Bruno
      -------------------------------------------------
      - http://www.brunozamborlin.com -
      -------------------------------------------------
    • Nov 11 2006 | 12:55 am
      >
      > So the questions would be two:
      > 1-Why I have to re-compile this class, if Java is multiplatform?
      i am not sure why you are having this problem. it shouldnt be the
      case. how are you transferring the class
      to the macintosh?
      > 2-How can I remove the "partition name" from the path, but just on
      > a macintosh platform?
      you could try using the function MaxSystem.maxPathToNativePath().
      This should translate the max style path
      output from thispatcher to something suitable for java.
    • Nov 11 2006 | 8:38 pm
      1-I'm recompiled the class on Macintosh. Now this "new" version seems to work properly boh with OSX and with XP.
      2-Thank you very much, this method works perfectly.
      Thank you very much for your help.
      Bruno
      -------------------------------------------------
      - http://www.brunozamborlin.com -
      -------------------------------------------------