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
redmapleleaf
Posts: 121
Registered: ‎11-29-2008
My Device: Not Specified

the import java.util.map cannot be resolved, newbie question

Hi all,

 

I need your help to get started. I have downloaded Eclipse with Blackberry plugins. So far I am able to compile and run all the sample examples for the Blackberry. However when I started doing my own application using java.util.Map package, I got the unresolved message 'the import java.util.Map cannot be resolved'.

 

Do you know what have I done wrong?

 

Thank you for your help.

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: the import java.util.map cannot be resolved, newbie question

java.util.Map does not exist on the MicroEdition platform.

 

See the Maps sample that comes with the JDE for an example of using maps on the RIM platform.

Please use plain text.
Developer
redmapleleaf
Posts: 121
Registered: ‎11-29-2008
My Device: Not Specified

Re: the import java.util.map cannot be resolved, newbie question

Hi RexDoug,

 

I wonder if we are we talking about the same thing? I was not refering to Maps and Location service. 

 

I have a number of unresolved imports in my code like


import java.util.Map;

import java.util.regex.*;

import java.io.File;

import java.io.FileInputStream;
import java.io.FileOutputStream;

import java.io.BufferedReader;

import java.util.zip.GZIPInputStream;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.InetAddress;

All of them have unresolved import problem so I thought I must be missing some library configuration. If these package are not available on the blackberry then would you be able to point me to some similar packages that I could use?

 

Thanks!

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: the import java.util.map cannot be resolved, newbie question

You are importing from Java SE, not Java ME. None of these exist on the Micro Edition platform.

 

Are you trying to write for the BlackBerry, or for a desktop?

 

Again, see the samples that come with the various BlackBerry JDE distributions.

 

My guess is that you have configured your project as a "standalone desktop" rather than as a "BlackBerry" project.

 

Please use plain text.
Developer
dognose
Posts: 51
Registered: ‎11-27-2008
My Device: Not Specified

Re: the import java.util.map cannot be resolved, newbie question

[ Edited ]

Simple Take a look at the Blackberry Api Reference, and you see, that java.net.* is not an included api

 

http://www.blackberry.com/developers/docs/4.7.0api/

 

example:

 

instead of using "import java.util.Map;"

try "import net.rim.blackberry.api.maps" (dont know if this is the same...)

 

and so on.

 

you should always have a look at the Blackberry Api Refrence, not only on the Sun's one (cause not all apis

are included)

 

dognose

Message Edited by dognose on 11-30-2008 12:56 PM
Please use plain text.
Developer
redmapleleaf
Posts: 121
Registered: ‎11-29-2008
My Device: Not Specified

Re: the import java.util.map cannot be resolved, newbie question

OK, I am trying to port an application from a PC and I guess that is the beginning of my problem. Isn't there a way to get around this problem? I am hoping not to have rewriting a lot of code, please tell me if I am wrong.

 

I am using the Blackberry project, not standalone desktop.

Please use plain text.
Developer
dognose
Posts: 51
Registered: ‎11-27-2008
My Device: Not Specified

Re: the import java.util.map cannot be resolved, newbie question

i dont know, if theres a automatic solution,

 

but i think you have to do the following:

 

replace the importet apis with the one you should refer in the Blackberry Enviroment.

find errors, where the Api didn't serve the requestet method / Object

then import the right one, or - if theres no one - take other code ^^

 

f.e. you use the java.io.file api. The object file in BB is reserved for signed aps,

so you have to úse the Fileconnector class, which will result in a bunch of new code... (or sign your

application)

 

regards,

dognose

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: the import java.util.map cannot be resolved, newbie question

OK, that explains the problem.

 

There is no magic when porting from SE to ME. The API support is similar but there are many things that are missing and/or different, especially with regards to networking and the UI library.

 

I would pull the existing classes over one at a time, researching the API support for each class and changing as needed.

 

 

Please use plain text.
New Contributor
damien-jkr
Posts: 7
Registered: ‎02-19-2010
My Device: BlackBerry Curve

Re: the import java.util.map cannot be resolved, newbie question

 


redmapleleaf wrote:

Hi RexDoug,

 

I wonder if we are we talking about the same thing? I was not refering to Maps and Location service. 

 

I have a number of unresolved imports in my code like


import java.util.Map;

import java.util.regex.*;

import java.io.File;

import java.io.FileInputStream;
import java.io.FileOutputStream;

import java.io.BufferedReader;

import java.util.zip.GZIPInputStream;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.InetAddress;

All of them have unresolved import problem so I thought I must be missing some library configuration. If these package are not available on the blackberry then would you be able to point me to some similar packages that I could use?

 

Thanks!


 

 

I've a problem with default library BlackBerry JRE, java.net not exist, java.io.BufferedReader to.

??

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

Re: the import java.util.map cannot be resolved, newbie question


damien-jkr wrote:

 

I've a problem with default library BlackBerry JRE, java.net not exist, java.io.BufferedReader to.

??


As RexDoug has stated, this is Java ME not Java SE.

 

There are many resources for learning how to make a network connection (one of the best is the post at the top of the Java Development forum). There may be a lot but go through it slowly and you will find everything you need to know about network connections.

---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.
Please use plain text.