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
Regular Contributor
DIegoR
Posts: 56
Registered: ‎08-15-2010
My Device: Z10

java.util.reflection outside BB JRE to preprocess external library

I have a library that was complied for BlackBerry JRE. The task is to extract all the methods and their parameters and types.I would like to use it to automate my code creation process.

There is a solution using with the java.util.reflection. It will not work on BB JRE for the known JavaME descendance. 

Can I do the same thing in Eclipse or any other way, may be preprocessor? I would like to have a list of methods and parameters from a jar file. Can this be done outside the compilation process?

I other words, do I need the BB JRE to get access to that  library complied for BB? Can I use it with a JavaCE JRE/JDK?

Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: java.util.reflection outside BB JRE to preprocess external library

If it's a COD file, then no java.util.reflection won't work. If it's a JAR file that was compiled for BlackBerry (in which case a COD file was created as well), then no java.util.reflection won't work.

If it's none of the above, then it's a normal Java library and java.util.reflection will work.
---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Regular Contributor
DIegoR
Posts: 56
Registered: ‎08-15-2010
My Device: Z10

Re: java.util.reflection outside BB JRE to preprocess external library

HI  rcmaniac25 !

Thanks for your time. Well, I do not know how the jar was compiled. It came as a single jar. Even if it is compiled for BB with a COD, somehow Eclipse can show its' methods and parameters in the project explorer view. What does it use then? Can it be I do not need the reflection?

Here is the library just in case https://www.x.com/servlet/JiveServlet/downloadBody/3841-102-1-4217/PayPal_MPL_1.0_BlackBerry-Develop...

Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.997 Dev OS, Z30 (STA100-5)-10.3.1.997 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: java.util.reflection outside BB JRE to preprocess external library

Ok, I checked the JAR you linked, you could do reflection with it as long as the reflection isn't expected to run on BlackBerry (BlackBerry doesn't have reflection capabilities right now, but you said you wanted to do reflection outside of the project).

 

The general explanation for why you can see the classes, methods, etc. is that it's a normal JAR file (just compiled under J2ME constraints, which means it will work on BlackBerry).

 

Compiling for BlackBerry

JAR (normal java program/library) -> RAPC -> JAR and COD.

 

The JAR file that RAPC produces will look like a normal java program/library, but if you try to run it, it will not work. The COD file, well that's self explanatory, it won't work on anything bug a BlackBerry.

 

That is why I specified if it's a JAR file that was compiled with a COD file. It is there so that you can link to it with Eclipse/JRE and use the classes/functions/etc.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.