Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 43
Registered: ‎05-13-2010
My Device: Blackberry 8520
My Carrier: T-Mobile

Re: Custom Library - Can't find entry point

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.

Contributor
Posts: 43
Registered: ‎05-13-2010
My Device: Blackberry 8520
My Carrier: T-Mobile

Re: Custom Library - Can't find entry point

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.

Contributor
Posts: 43
Registered: ‎05-13-2010
My Device: Blackberry 8520
My Carrier: T-Mobile

Re: Custom Library - Can't find entry point

If I can't find a solution today I will have to file a help request with RIM. Anyone know how much that usually costs?

Developer
Developer
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Custom Library - Can't find entry point

libraries dont contain a main function but a libMain if you need to use one at all.

Developer
Posts: 516
Registered: ‎07-23-2010
My Device: 9900

Re: Custom Library - Can't find entry point

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