Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

J2ME: "Invalid constant pool entry"

Options
  • 10-02-2003 2:22pm
    #1
    Closed Accounts Posts: 19,777 ✭✭✭✭


    Let me preface this by saying that my Java is seriously rusty, but I did RTFM/STFW before coming here ;)

    I've a midlet, which works fine until I try to insatiate a double - compiles all right, but exits upon running on a device/emulator with the error message "Invalid constant pool entry".

    Any suggestions?


Comments

  • Registered Users Posts: 2,010 ✭✭✭Dr_Teeth


    I didn't think the KVM let you use floats.. I can imagine the class loader getting annoyed when trying to populate a constant pool if one of the items is a float-type like a Double

    Dunno for sure though, my J2ME is way rusty! I would have assumed your pre-processor would catch something like that before you got to run your midlet.

    Teeth.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Originally posted by Dr_Teeth
    I didn't think the KVM let you use floats.. I can imagine the class loader getting annoyed when trying to populate a constant pool if one of the items is a float-type like a Double
    Actually the compiler borks if I try to use floats (that look like doubles) but compiles normally with doubles - which I thought odd as the last time I used Java on a mobile device (Waba on PalmOS) it flat out refused (difficult to get doubles on a 16-bit device :( ).

    If I can't find a good answer somwhere, I may try a dirty hack...


  • Registered Users Posts: 2,010 ✭✭✭Dr_Teeth




  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    I did actually look about a bit more and found that J2ME won’t support doubles/floats, which I’ve come across before on handheld devices before on the Waba platform. The compiler wasn’t borking on the use of doubles, which is what had me confused to begin with.

    Apparently there’s no way round it outside of using a dirty hack (such as two longs; one for the integer and one for the decimal of your float/double) or importing a third party maths package to simulate doubles/floats (effectively an implementation of the aforementioned dirty hack).


  • Registered Users Posts: 2,010 ✭✭✭Dr_Teeth


    Yup, that's the way it is for CLDC anyway. You'll have to move up to a more featurefull configuration if you want that fancy stuff.

    Floats! posh git!

    Teeth.


  • Advertisement
  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    If memory serves, and it mightn't considering I'm in south america ;), you solved your Waba problem with the use of strings.

    just a thought.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    I did, but as I said the compiler wasn’t borking on the use of doubles, so I'd (wrongly) assumed I could use them.

    Argentina?


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    When you fix it post your code. I want to see it.


    No, Peru. Argentina tomorrow.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    I've emailed it to you, as it's not strictly speaking meant for public consumption.


Advertisement