Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jan 2004

    series 40 jar files

    All Files in jar seem to be accessible i.e. can be read through getClass().getResourceAsStream(String fileName), even manifest and raw class files, but situation is not so clear as it comes to series 40 emulator (7210). Trying to open InputStream to .class file there, no matter how and what name I try, I get:

    [Info] Nokia 7210 MIDP SDK v1.0: Exception: java/io/IOException
    [Info] Nokia 7210 MIDP SDK v1.0: at com.sun.midp.io.ResourceInputStream.<init>(+24)
    [Info] Nokia 7210 MIDP SDK v1.0: at java.lang.Class.getResourceAsStream(+83)

    On series 60 emulator it works fine as on phones of other vendors, that I tried. I don't have access to a real series 40 phone to test - how do you think - is this behaviour limited to this specific emulator OR on series 40 you can expect some problems reading (maybe n o t o n l y ) files with .class extension?

  2. #2
    Super Contributor
    Join Date
    Nov 2003
    Bangalore , India
    Hi ,
    Could u please post that sample code that U have been working with??So that I can check it.


  3. #3
    Registered User
    Join Date
    Jan 2004
    There's nothing special there:

    DataInputStream dis = new DataInputStream(getClass().getResourceAsStream("/My_midlet.class"));
    // previously initialized byte array (it's size dosn't matter just to check if there are any bytes in the stream) - this line is not reached due to described exception
    catch(Exception e){

    Thanks in advance if you check this on a phone on any midlet just replacing the name with any of your class names, checking results like this:

    int ret = dis.read(byteArray);
    Alert al = new Alert(null);
    display.setCurrent("Returned: " + al);

  4. #4
    Super Contributor
    Join Date
    Dec 2005

    Lightbulb Re: series 40 jar files

    Your code seems to be missing the way to access class root
    This code would seem to find it.
    In this code I look for the ####.j2me.http.Protocol file and eventually will load the new protocol file I want to load.

    private void ProtocBase(){
    /* Set up the library class root path */
    /* This may vary from one CLDC implementation to another */
    classRoot = System.getProperty("javax.microedition.io.Connector.protocolpath");
    if (classRoot == null) {
    classRoot = "com.sun.cldc.io";
    try {

    /* Use the platform and protocol names to look up */
    /* a class to implement the connection */
    clazz =
    Class.forName(classRoot +
    "." + "j2me" +
    "." + "http" + ".Protocol");

    } catch (ClassNotFoundException x) {


    Whilst running this under netBeans 4.1 the JME emulator gave the name:-
    giving "com.sun.kvem.io"
    So you wont see anything. If you open up kvem.jar with WinRAR you will see the structures and the classes for the emulator

    The result being :-
    Class clazz = class "com.sun.kvem.io.j2me.http.Protocol"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts