Menu

Missing external library in jar

KW Yan
2009-11-23
2013-04-25
  • KW Yan

    KW Yan - 2009-11-23

    The test.jar does not contain lib_clib.class (Note: compliation is sucessful but can't run in emulator. Error: No Class Def Found Error)

    **Test.mpsrc:**

        program Test;
       
        uses
           CLib;
       
        var
           c : char;
       
        begin
          drawtext (CLib.Test, 0,0);
          repaint;
          delay(2000);
        end.

    **Lib_clib.java:**

        import java.lang.*;
        import java.io.*;
        import javax.microedition.lcdui.*;
        import javax.microedition.io.*;
        import javax.microedition.io.file.*;
       
        public class Lib_clib
        {
       
        public static String test() {
           return "This is from LIB_CLIB";
        }
        }


    Note: Test in 3.0 Alpha 2

     
  • Javier Santo Domingo

    Yes, currently it does not include external libraries into the JAR file automatically. An information message appears into the compiler message window when a unit uses an external library, but the external library itself is not being handled yet.
    It is more or less related to the other *uses-clause-related-feature-to-be-implemented*: the Unit Dependency Order (which currently must be done manually by editing by hand the project file). I wrote about this one in the ALPHA 1 readme, but I was not clear enough about the non inclusion of external libraries yet, my fault.

    These are two of the most important things that remains to achieve the BETA stage (defined as "the first 3.0 IDE that, at least, has -more or less- the same features than MP 2.0, with some extra enhacements, of course"). But the good news is that we are not so far :)

    By the moment, with MP 3.0 ALPHA 2, there are 2 solutions available.

    1) add the external library into the resources section using the MP 3.0 Command Line Project Manager (since the IDE does not have the options to add/remove them, this is going to be coded soon too). Let's say, if you have your Test project into the C:\Test directory, you use:

        C:\Program Files\MIDletPascal 3.0 ALPHA 2>mp3clpm addrf C:\Test\Test.mpproj Libs\Lib_clib.class

    and the external library will be added to the project's resources (copied to the res directory).

    This is the same that when you included in MP 2.0 an external library (that you dont reference in code), that is used by another external library (that you reference in code).

    2) add the external library manually into de JAR file generated.

    Any of them will cause the external library to get included into the JAR file and the midlet will work normally.

    Thanks for the report and the testing!

     
  • KW Yan

    KW Yan - 2009-11-30

    Already fixed in 3.0 Alpha 3. Thanks.

     

Log in to post a comment.