09-08-2010 10:25 AM
This is not the actual code. This is the code stripped down just to try and get something to run. In essence I'm just trying to get a group of functions I create to be referenced by other projects. The idea is that it can be distributed to others workon on similar projects. It's not so much trying to get this application to work but the basis of any jar running as a library.
Perhaps Iam going about it the wrong way. How would I design the interface and then create the cod file for this? This works in eclipse and I can reference the functions using myLib.functionName(); but when it runs I get a "Can't find entry point" error. My conclusion is that I mus be building the Library Wrong.
09-09-2010 04:55 PM
Ok So I'm going to list my steps one by one from making the library file to importing it into my project.
CREATING MY LIBRARY FILE
1) Create a new Blackberry Project.( Calling it myLibProj )
2) Add a new class with a public static void main(String args) and a constructor Making sure to define a package that is not default.
3) In the Blackberry_App_Descriptor.xml Change the Application type to Library
4) RT Click the project(myLibProj), Select Blackberry, Select Package Project
5) Rt Click the Project(myLibProj) and Select Export
6) Select Java->JAR file and click next
7) Check off Export generated class files and source
8) Check off Export java source files and resources
9) Check off Export refactorings for checked projects
10) choose a export locationand click next twice
11) select generate th manifest file
12) Select the Main Class to use as an entry point.
13) Click Finished
14) Preverify the JAR using preverify.exe from the commandline
IMPORTING LIBRARY INTO NEW PROJECT
15) Create a new project ( Calling it myAPPProj )
16) Rt click project(myAPPProj) and select Import
17) Select File System and click next
18) Browse to the output folder and select the preverified JAR file
19) Click Finished
20) Rt Click on the project(myAPPProj) and select properties
21) Select Java Build Path and click the Libraries tab
22) Click Add JARs
23) Expand your project (myAPPProj) and choose the preverified JAR file
24) you can now reference classes from your jar inside your new project.using package.FunctionCall
This compiles fine but when I test it in the simulator, I get a Can't Find Entry Point error. Hopefully someone can try this out and reproduce my error. If you see anything I did wrong please tell me.
09-13-2010 06:29 AM
Make sure you check Auto-run on startup for the library if you want it to execute the main method during startup. Like CMY mentioned make sure you replace your main method with libMain