J2ME: How to load external library?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SpaceCowboy

    #1

    J2ME: How to load external library?

    To begin, I'm using JBuilder9 under J2ME and MIDP 1.0. I'm trying to use an
    external library. I can get my code to compile, but I can't get the library
    code working on the emulator.

    I'm working on a poker game, and have come quiet far with it. I'm to the
    point I need to write a hand evaluation system. As luck would have it, these
    guys have a Java open source hand evaluation program already written.



    So, I download their code, but now I don't know how to get it into my
    project. I am using JBuilder, and was able to add the .jar files under
    Tools/Configure JDK. I can then import the libraries and the autocompletion
    finds it, it compiles correctly, but then when I go to run it on the
    emulator (Nokia developer's suite emulator), I get a class not found error.

    I know that I need to get this library somehow packed into the .jar/.jad
    files that the phone will run, but I don't know how to do this. When I tried
    to unpack these files into my src directory, I got it to compile, but then
    couldn't get an application created because of pre-verifier errors.

    Does anyone have any suggestions on this? I've been stuck for several days
    because of this problem and I don't know what to do next.

    SpaceCowboy

    P.S. Sorry for the cross-post, but I'm having an incredibly difficult time
    getting any help to the problems I run into.


  • Darryl L. Pierce

    #2
    Re: J2ME: How to load external library?

    SpaceCowboy wrote:[color=blue]
    > To begin, I'm using JBuilder9 under J2ME and MIDP 1.0. I'm trying to use an
    > external library. I can get my code to compile, but I can't get the library
    > code working on the emulator.[/color]

    <snip>

    All code that's used by your MIDlet that's *not* a part of the device
    has to be supplied by your MIDlet suite. So, if you're using 3rd party
    code, you have to bundle *all* of the code you're using into *your* JAR
    file.

    --
    Darryl L. Pierce <mcpierce@myrea lbox.com>
    Visit the Infobahn Offramp - <http://bellsouthpwp.ne t/m/c/mcpierce>
    "What do you care what other people think, Mr. Feynman?"

    Comment

    • SpaceCowboy

      #3
      Re: J2ME: How to load external library?

      I'm still relatively new to Java. Would this mean I would need to basically
      add the individual files to my project, or is there some way to compile 3rd
      party JARs into the JAR for my midlet suite.

      SpaceCowboy

      "Darryl L. Pierce" <mcpierce@myrea lbox.com> wrote in message
      news:ad103dfcf8 52e1403b6e27140 2a73d18@news.te ranews.com...[color=blue]
      > SpaceCowboy wrote:[color=green]
      > > To begin, I'm using JBuilder9 under J2ME and MIDP 1.0. I'm trying to[/color][/color]
      use an[color=blue][color=green]
      > > external library. I can get my code to compile, but I can't get the[/color][/color]
      library[color=blue][color=green]
      > > code working on the emulator.[/color]
      >
      > <snip>
      >
      > All code that's used by your MIDlet that's *not* a part of the device
      > has to be supplied by your MIDlet suite. So, if you're using 3rd party
      > code, you have to bundle *all* of the code you're using into *your* JAR
      > file.
      >
      > --
      > Darryl L. Pierce <mcpierce@myrea lbox.com>
      > Visit the Infobahn Offramp - <http://bellsouthpwp.ne t/m/c/mcpierce>
      > "What do you care what other people think, Mr. Feynman?"
      >[/color]


      Comment

      • Darryl L. Pierce

        #4
        Re: J2ME: How to load external library?

        SpaceCowboy wrote:[color=blue]
        > I'm still relatively new to Java. Would this mean I would need to basically
        > add the individual files to my project, or is there some way to compile 3rd
        > party JARs into the JAR for my midlet suite.[/color]

        You would have to extract the files out of the 3rd party JAR file and
        put them into your own JAR file along with your code/resources.

        --
        Darryl L. Pierce <mcpierce@myrea lbox.com>
        Visit the Infobahn Offramp - <http://bellsouthpwp.ne t/m/c/mcpierce>
        "What do you care what other people think, Mr. Feynman?"

        Comment

        Working...