Shop OBEX P1 Docs P2 Docs Learn Events
Error Linking java code with java/lang/StringBuffer.append — Parallax Forums

Error Linking java code with java/lang/StringBuffer.append

DorlingDorling Posts: 32
edited 2007-06-02 23:46 in General Discussion
My java code Compile but will not Link i get the following error:

[noparse][[/noparse] Error JVM-0031] cannot find linked method (java/lang/StringBuffer.append).

The only place I am using a StringBuffer is below

  private static char c;

  public static void getStringFromUser(StringBuffer s) {
    s.clear();
    c = (char) Terminal.getChar();
    while (c != '\r') {
      s.append(c);
      c = (char) Terminal.getChar();
    }
  }




The error Window said

Error: Cannot find linked method (%s.%s).

Description: The named method could not be found.

Solution: Report the error to technical support.

Many Thanks for any help

Jonathan

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-06-02 18:28
    Add
    import stamp.core.*;

    at the top of your code.

    regards peter

    Post Edited (Peter Verkaik) : 6/2/2007 6:34:05 PM GMT
  • DorlingDorling Posts: 32
    edited 2007-06-02 21:00
    That was just the code which contains the append method from StringBuffer.

    If that was the problem it would not Compile with jikes. It just can't Link the files so that it can download the files. I found out it was to do with this line it was to do with.

    System.out.println("rx.byteAvailable(): " + rx.byteAvailable());
    



    I have now change it. But if this was a problem why does it Compile. It is not a problem with normal java!!

    Many Thanks

    Jonathan
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-06-02 21:06
    I created the folders to hold the several sources.
    I can reproduce the error.
    Channel.java uses synchronized keyword. Not supported by javelin.
    Only there to keep compiler happy.
    Removing it has no effect on link error (but remove it anyway).
    I reprogrammed the StringBuffer as char[noparse]/noparse and resolved compiler errors.
    The link error even then persists (though StringBuffer is not used anymore).
    At this moment the best advice is to remove any code
    that you added since your last succesful programming.

    regards peter
  • DorlingDorling Posts: 32
    edited 2007-06-02 23:17
    Many Thanks

    Have you see my last post!
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-06-02 23:46
    Adding a boolean to a String?
    In pc java that means adding "true" or "false" I guess.
    Note on adding Strings:
    Don't do that at all for temporary purposes, the javelin has no garbage collection
    so this will result in out of memory errors· eventually.
    What happened here I think is that the Jikes compiler accepted the construction
    as it is a normal pc java compiler. But the linker is written
    for the javelin and as such sometimes chokes on generated bytecode
    sequences, and this is probably one of those.

    regards peter
Sign In or Register to comment.