BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 04-24-2006, 08:59 AM   #1
alipolatolu
New Member
 
Join Date: Apr 2006
Location: Turkey
Model: 8100
Carrier: TURKCELL
Posts: 9
Default import external .jar files from JDE

Please Login to Remove!

Hi;

How can I import JAR files to my project in BlackBerry JDE.

I'm using BlackBerry JDE v4.1.0.185 and I need to import .jar files to my project.

I simply do the following steps:
1) Right-click to project and select Properties Menu Item.
2) Open the Build tab.
3) In the "Imported jar files" section, I add the appropriate jar files to my project.

After these steps my project is compiling successfully but when I try to run my application on Simulator I get the error below:

Code:
Searching installed codfiles for alias 'db4o-5.2-java1.2'
Searching uninstalled codfiles for alias 'db4o-5.2-java1.2'
Module 'db4o-5.2-java1.2' not found.Error starting <Project Name>: Module 'db4o-5.2-java1.2' not found.
I searched the forum but can not find the solution.

Regards.
Offline  
Old 04-24-2006, 12:32 PM   #2
Ryson
New Member
 
Join Date: Apr 2006
Location: Germany
Model: 7230
Posts: 11
Default

I had the same problem with kxml.
The blackberry.com knowledge-center has an article about this.

This forum says, i can't post the link, so here is the text:
Quote:
How To - Compile a jar file into a BlackBerry Library
Last Updated: February 17, 2005
Article Number: DB-00042


--------------------------------------------------------------------------------

Summary
This article applies to the following:

BlackBerry® Wireless Handhelds™ based on Java™
BlackBerry® Java Development Environment (JDE)


--------------------------------------------------------------------------------

Details
You can include classes from other compiled .jar files in your application. To include these files, save the .jar file in a new project, in the same workspace as your application. Make this new project a library application and make your application dependent on this library. You can then import all of its classes. To complete this procedure, perform the following steps:

To create a new project

Open the workspace that contains your application's project.
Create a new project.
To add a compiled .jar file to the project

In the navigation pane, select the project.
On the Build menu, select Project < Add File to Project.
Select the appropriate .jar file and click Open.
To make the project a library

In the navigation pane, select the project.
Right-click and click Properties. The <Project name> Class Properties window appears.
Click the Application tab.
From the Project Type drop-down list, select Library.
To compile the project

In the navigation pane, select the project.
Right-click and click Build Project.
To make the project dependent on the new library

In the navigation pane, select the project.
Right-click and click Project Dependencies. The Class depends on <Project name:> window appears.
Select the <Project name> check box.
Your application can now import the classes in this .jar file with the "import xxx.yyy.*" command.



--------------------------------------------------------------------------------

Keywords
include, import, classpath, library, .jar, project
Maybe you have to preverify the library.
But in this forum is a thread about that.
Offline  
Old 04-24-2006, 12:56 PM   #3
alipolatolu
New Member
 
Join Date: Apr 2006
Location: Turkey
Model: 8100
Carrier: TURKCELL
Posts: 9
Default

Hello;

I also saw and tried this solution. But It did not solve our problem. Can you solve the problem with Library project solution?

Thank you for your answer.
Offline  
Old 04-24-2006, 03:09 PM   #4
Ryson
New Member
 
Join Date: Apr 2006
Location: Germany
Model: 7230
Posts: 11
Default

Yes, it works. Did you get any error message?
Offline  
Old 04-25-2006, 02:04 AM   #5
alipolatolu
New Member
 
Join Date: Apr 2006
Location: Turkey
Model: 8100
Carrier: TURKCELL
Posts: 9
Default

yes, I got some errors about library file that I added to library project. Firstly, I'm trying to use db4o and kSOAP libraries. I added ksoap2-j2me-core-2.1.0.jar to my library project and try to build library project only. I got some errors like below:

Code:
org.kobjects.base64.Base64: Error!: Missing stack map at label: 165
this error is about the jar library. I got same errors for db4o jar file.

My library has a main class that has a main() c'tor method. I got same error messages if there is a main class or not.

Thanks.
Offline  
Old 04-25-2006, 05:18 AM   #6
Ryson
New Member
 
Join Date: Apr 2006
Location: Germany
Model: 7230
Posts: 11
Default

Thats why i said maybe yo have to preverify the package first.

The short way is:
Quote:
C:\Program Files\Research In Motion\BlackBerry JDE 4.0\bin>preverify -classpath "C:\Program Files\Research In Motion\BlackBerry JDE 4.0\lib\net_rim_api.jar" "D:\RIMClient\Standard\lib\kxmlrpc_full.jar"
If you have problems:
Quote:
Unpack the jar file, preverify ALL(!) the classes manually (e.g. use a batch file, it's easier) and re-jar them. Then it should work.
Quote:
I suppose you're on a windows system...?

Okay, first unpack the .jar (or .zip) file (doesn't matter in which folder):

jar xf kxml2.jar
OR use a ZIP unpacker.

Notes:
1. You should check if it unpacks in the right directory structure, that means: the classes are located in subdirectories of "org\kxml2\io" and "org\xmlpull\v1".
2. When preverifying all preverified classes are saved in a subdirectory "output" by default.

Okay, now create a batch-file with the following commands:

-------------------
%J2MEWTK%\bin\preverify -classpath .;%J2MEWTK%\lib\midpapi.zip org.kxml2.io.KXmlParser

%J2MEWTK%\bin\preverify -classpath .;%J2MEWTK%\lib\midpapi.zip org.xmlpull.v1.XmlPullParser

%J2MEWTK%\bin\preverify -classpath .;%J2MEWTK%\lib\midpapi.zip org.xmlpull.v1.XmlPullParserException

%J2MEWTK%\bin\preverify -classpath .;%J2MEWTK%\lib\midpapi.zip org.xmlpull.v1.XmlPullParserFactory

cd output

%JAVA_HOME%\bin\jar -cvf ..\kxml2.jar org
-------------------

%J2MEWTK% stands for the root directory of your J2ME Wireless Toolkit (e.g. C:\J2MEWTK)
%JAVA_HOME% stands for the root of your Java2 SDK (e.g. C:\j2sdk)

P.S.: The batch file should be placed in the directory to which you unpacked the package.
Offline  
Old 04-26-2006, 02:06 AM   #7
alipolatolu
New Member
 
Join Date: Apr 2006
Location: Turkey
Model: 8100
Carrier: TURKCELL
Posts: 9
Default

Hi Ryson;

Thanks for your kind help. I tried to preverify the ksoap2 .jar file but it is not successfull. I got error while preverify operation. did you (or any one) use ksoap1 or ksoap2 with BlackBerry JDE? If so, can you please send me your ksoap library? Version is not important for now, I need to call ASP.NET Web Service functions and get response from server only :o)

I downloaded kSOAP libraries but can't work with them. Maybe, the library that I have downloaded is wrong.

Thanks and Best Regards.
Offline  
Old 04-26-2006, 12:43 PM   #8
Ryson
New Member
 
Join Date: Apr 2006
Location: Germany
Model: 7230
Posts: 11
Default

Which error?
Offline  
Old 04-26-2006, 01:36 PM   #9
alipolatolu
New Member
 
Join Date: Apr 2006
Location: Turkey
Model: 8100
Carrier: TURKCELL
Posts: 9
Default

The error is below:

Code:
C:\Program Files\Research In Motion\BlackBerry JDE 4.1.0\bin>preverify -classpath "C:\Program Files\Research In Motion\BlackBerry JDE 4.1.0\lib\net_rim_api.jar" "C:\Documents and Settings\alipolat.olu\Desktop\ksoap\ksoap2\ksoap2-j2me-full-2
.1.0.jar"
Error preverifying class org.kobjects.xmlrpc.Driver
    VERIFIER ERROR org/kobjects/xmlrpc/Driver.main([Ljava/lang/String;)V:
Cannot find class java/io/FileReader
I don't know exactly what to do. If I can find a library that works for BlackBerry JDE it will be easier.
Offline  
Old 04-27-2006, 06:48 AM   #10
alipolatolu
New Member
 
Join Date: Apr 2006
Location: Turkey
Model: 8100
Carrier: TURKCELL
Posts: 9
Default

Hi again;

I successfully ran preverify command. Now, I can run the kSOAP2 library from BlackBerry.

Thanks.
Offline  
Old 05-31-2006, 01:35 AM   #11
nagain
New Member
 
Join Date: May 2006
Model: 7290
Posts: 1
Default

Quote:
Originally Posted by alipolatolu
The error is below:

Code:
C:\Program Files\Research In Motion\BlackBerry JDE 4.1.0\bin>preverify -classpath "C:\Program Files\Research In Motion\BlackBerry JDE 4.1.0\lib\net_rim_api.jar" "C:\Documents and Settings\alipolat.olu\Desktop\ksoap\ksoap2\ksoap2-j2me-full-2
.1.0.jar"
Error preverifying class org.kobjects.xmlrpc.Driver
    VERIFIER ERROR org/kobjects/xmlrpc/Driver.main([Ljava/lang/String;)V:
Cannot find class java/io/FileReader
I don't know exactly what to do. If I can find a library that works for BlackBerry JDE it will be easier.
Code:
C:\Program Files\Research In Motion\BlackBerry JDE 4.1.0\bin>preverify -classpath "C:\Program Files\Research In Motion\BlackBerry JDE 4.1.0\lib\net_rim_api.jar" "C:\Documents and Settings\alipolat.olu\Desktop\ksoap\ksoap2\ksoap2-j2me-full-2
.1.0.jar"
Error preverifying class org.kobjects.xmlrpc.Driver
VERIFIER ERROR org/kobjects/xmlrpc/Driver.main([Ljava/lang/String;)V:
Cannot find class java/io/FileReader

hi alipolatolu , i have the same problem problem with you. How u can run preverify command?
thanks.
Offline  
Old 05-31-2006, 02:19 AM   #12
alipolatolu
New Member
 
Join Date: Apr 2006
Location: Turkey
Model: 8100
Carrier: TURKCELL
Posts: 9
Default

Hi;

Firstly I suggest you to use kSOAP1, It's better than kSOAP2. If you want, I can send you preverified kSOAP1 library.

I was preverified ksoap-j2me-core-2.1.0.jar, not ksoap-j2me-full-2.1.0.jar. I'm still getting same error for full kSOAP, but core library is preverifying successfully.

if you want the preverified libraries, Send me your e-mail address with private message, i will send them to you.

HTH.
Polat.
Offline  
Old 05-31-2006, 09:53 AM   #13
itnwc
New Member
 
Join Date: Apr 2006
Model: 7100
Posts: 7
Default

i use not only ksoap1 but also ksoap2, with both lib i can get it work , but there is always problem when importing a ksoap jar file, so i use always the source files (java files), and the two versions work good. maybe you can use ksoap1.0 jar file as alipolatolu said. i have never tried it.

good luck

itnwc
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Vintage V-Mac Industries Inc. Pipe Threader Vosper Drophead Threader - READ picture

Vintage V-Mac Industries Inc. Pipe Threader Vosper Drophead Threader - READ

$199.00



Vintage Mac Tools AW343 Series 1/2 Pneumatic Impact Driver  picture

Vintage Mac Tools AW343 Series 1/2 Pneumatic Impact Driver

$50.00



Vintage Mac Warehouse  3.5” Floppy Disk Solar Powered Calculator Company Swag picture

Vintage Mac Warehouse 3.5” Floppy Disk Solar Powered Calculator Company Swag

$66.60



Vintage MAC Tools UVEX Adjustable Safety Glasses Motorcycle Mechanic Lawnmower picture

Vintage MAC Tools UVEX Adjustable Safety Glasses Motorcycle Mechanic Lawnmower

$64.99



Vintage VTG A. W. Mack 122387 Large Industrial Fuse Puller 100 Amp - 600 Amp picture

Vintage VTG A. W. Mack 122387 Large Industrial Fuse Puller 100 Amp - 600 Amp

$104.99



Vintage UNHOLTZ-DICKIE MAC-6C Equipment - Untested As-is picture

Vintage UNHOLTZ-DICKIE MAC-6C Equipment - Untested As-is

$71.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.