MXJ class problems

    Jun 16 2006 | 5:08 am
    Hi all,
    I am compiling MXJ objects but have spent so much time trying to compile the class using eclipse and mxj quickie one day it is working and then as i try to recompile the class it stops working. It has worked using quickie and eclipse. Granted I am new to MXJ but am unsure why it works sometimes and not others. any reason why this is happening?
    I have uninstalled Max and recompiled several times on two computers.
    Quickie seems to stall max when i try to delete it from the patcher window... which is bizzar... because it says it was compiled successfully...
    FYI I am using the googleIMG-java code.
    anyhelp is most welcome.
    Thanks in advance

    • Jun 16 2006 | 6:19 am
      Hi Tim, It's really hard to help you unless you can be more specific about what "stops working" means. The object loads but has the old behaviour? Your code won't compile? The object won't load? mxj doesn't work at all?
    • Jun 16 2006 | 9:47 am
      On 16 Jun 2006, at 06:08, Timothy Devine wrote:
      > It has worked using quickie and eclipse.
      As Ben suggests, it's hard to determine what might at fault without more information, but a common cause for Java problems is a messed-up classpath, or class/JAR files being created in the wrong place. I use Eclipse for MXJ development, with a customised project configuration and settings in the MXJ configuration file, but it's possible that Eclipse and Quickie are putting the class files in different places, and/or making different decisions about when to recompile.
      Can you give more details about your configuration? Oh, and Mac or PC?
      -- N.
      nick rothwell -- composition, systems, performance -- http://
    • Jun 17 2006 | 12:50 am
      Ok sorry. i thought is was a little vague. first, i am running latest osx, max, jitter, java... all have been updated.
      So the story goes,
      I tried to compile googleIMG using Quickie and it worked fine. but then it stopped working the next day i tried to use it.
      oh I had a few problem with restrictions on the folder in the app Support cycling74 java... i had to enable read and write... that allowed me to complie it firstly in quickie
      so I recomplied it again in quickie and it said it was successful (green text etc...) but when i tried to detlete the mxj quickie object i got the spinning rainbow wheel forever...
      and creating an mxj googleIMG did the same thing
      so it said it compiled ok but then would stall max
      that is the quickie story....
      i have to shoot off to work, i will post the eclipse story soon.. it is quite similar though... oh and the quickiecompile ok and stall happend on a g5 and a powerbook
      thanks for you replies
      i appreciate it
    • Jun 17 2006 | 8:09 am
      Ok i am back!
      The object I compiled in Eclipse following the MXJ Eclipse instructions on the Cycling website, (great help, thankyou) worked fine for a day. Then i set about changing the file and recompiling it with a slight change in the code. this didn't work and would not work with the original unchanged code.
      I have recompiled and uninstalled everything several times. I get no errors when using the MXJ googleIMG object in the max window, just a bang... so it is just not working like it has, by returning a number of urls. Having just written that I will check if it is being blocked by little snitch or something like that when i get back to the office on monday.
    • Jun 20 2006 | 2:22 am
      Super! Arrived at the gallery to find the google image search was working perfectly without having to do anything what so ever! I just turned it on and started my patch to see what was happening and bang(ha) it worked!
      Unbelievable! it is not working again! I have no idea what this problem is and expect that nobody else does. This is such a random problem. Which makes me think the problems lie outside of the computer in the network or googleIMG object or Google Image search engine.
      I have no idea (how anyone can help).
      I 'just' need to do safe img search and restrict the size.
      Here is the googleIMG java FYI maybe it is set to work only even days of the week!
      _______________________ import com.cycling74.max.*; import*; import*; import javax.swing.text.*; import javax.swing.text.html.*;
      public class googleIMG extends MaxObject { public void anything(String str, Atom[] args) { EditorKit kit = new HTMLEditorKit(); Document doc = kit.createDefaultDocument();
      // The Document class does not yet handle charset's properly. doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE); try { // Create a reader on the HTML content. Reader rd = getReader(str,args[1].getInt(),args[0].getInt());
      // Parse the HTML., doc, 0);
      // Iterate through the elements of the HTML document. ElementIterator it = new ElementIterator(doc);
      javax.swing.text.Element elem;
      while ((elem = != null) {
      SimpleAttributeSet s = (SimpleAttributeSet) elem.getAttributes().getAttribute(HTML.Tag.A);
      if (s != null) {
      String link = s.getAttribute(HTML.Attribute.HREF).toString();
      if(link.startsWith("/imgres")) { int start = link.indexOf("/imgres?imgurl=") + 15; int end = link.indexOf("&imgrefurl="); String imgUrl = link.substring(start, end); outlet(0,imgUrl); }
      } catch (Exception e) { e.printStackTrace(); } }
      static Reader getReader(String term, int num, int start) throws IOException {
      //System.out.println("" + start + "&num=" + num + "&q=" + term);
      URLConnection conn = new URL("" + start + "&num=" + num + "&q=" + term).openConnection(); conn.addRequestProperty("User-Agent", "Mozilla/4.76");
      return new InputStreamReader(conn.getInputStream());
      } }
    • Jun 20 2006 | 11:47 am
      Ok I am sorry that i keep responding to my own posts but i think i can finally put this to rest and maybe oneday somebody else will find a use for it.
      It seems that I compiled the java classes fine and that the problem was in that the googleIMG code uses Firefox in someway and the network i use to connect to the internet would only work with safari. put simply safari worked - firefox didn't.
      The tech enabled acces with Firefox and the object started working again!
      If it works tomorrow then all is good.