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
Developer
Posts: 248
Registered: ‎11-23-2009
My Device: Not Specified

How to Create .class file

Hi,

 

i know that we can create a .class file from .java file by compiling it. However i am unable to do the same with some of the .java files of my blackberry application. The java compiler gives error for BB specific namespaces and classes.

 

Can anyone tell me how we can create .class files for the .java files in our BB application?

 

Thanks,

Saket

Developer
Posts: 184
Registered: ‎10-28-2009
My Device: Not Specified

Re: How to Create .class file

hi

 

 

you follow this link...

 

http://developerlife.com/tutorials/?p=478

 

 

savi

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to Create .class file

Why do you want to do this?

Developer
Posts: 248
Registered: ‎11-23-2009
My Device: Not Specified

Re: How to Create .class file

There are 2 reasons for doing this:

 

1> I have different applications on BB that have very similar requirments. By putting the common classes in a jar file i can simply import them in whichever app i want and use them. This allows for code reuse and also if i need to make any future fixes i dont have to make the same changes to all my apps.

 

2> The size of the code is expanding. I want to put all the related classes into a single jar file and use these jars in my application.

 

Thanks,
Saket

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to Create .class file

[ Edited ]

Remember that the BlackBerry does not use a jar file, it uses cod files.  So you can organize things the way you want, but you will have to do it by putting the classes you want in one cod (= one jar) in one project.  Make this a Library project and then you can do what you want.

 

It is my understanding that the BlackBerry only supports one version of any class.  So if you have two applications that share the same jar (i.e. cod), then you will only have one copy of that cod installed on the device.  So if you want to share code, you will need to be careful about how you manage your applications.

 

In short, the option you are looking for of moving classes around into various cods is not supported on the BlackBerry, you need to do this with the source and manage the source into shared Libraries. 

Developer
Posts: 248
Registered: ‎11-23-2009
My Device: Not Specified

Re: How to Create .class file

Okay thanks Peter!

 

Now i have a better understanding of what can be done with BB code files.

 

Also i would really appreciate if you could explain to me the meaning of the last line of your previous post:

 

"and manage the source into shared Libraries."

 

Thanks,

Saket

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to Create .class file

For manage, read 'move'. 

 

What I think you were wanting to do was to create a jar by moving the class files into it.  You will have t move the source files that should be in that jar, into a separate project.