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
New Developer
neil1967
Posts: 7
Registered: ‎11-14-2008
My Device: Not Specified

missing java.net

Howdy folks, java newbie here.  I've been trying to build a test application that uses the java.net package, but when I import it, the build complains that it doesn't exist.  I don't know how RIM's jre does paths, but I have, at the system and user level on my machine, the JAVA_HOME variable set to where I think it should point (c:\program files\java\jre1.6.0_05).  When I'm typing out the import line in the .java file, the autocomplete when I type "import java." only shows rmi, lang, io and util, but I just don't know where it's looking.  Any help would be appreciated.

 

Neil

Please use plain text.
New Developer
neil1967
Posts: 7
Registered: ‎11-14-2008
My Device: Not Specified

Re: missing java.net

okay, so I found net_rim_api.jar doesn't have java.net. any ideas on how to add it?
Please use plain text.
Developer
davidmccormack
Posts: 168
Registered: ‎11-01-2008
My Device: Galaxy S II
My Carrier: Meteor (Ireland)

Re: missing java.net

In short, you're not going to find the java.net package. Remember that the BlackBerry uses Java Micro Edition (J2ME) rather than Java Standard Edition (J2SE). With J2ME you do all your networking via the Connector class in the javax.microedition.io package. Look it up. If, like me, you're coming at this from a desktop software development background you'll probably spend the next hour going "no...they can't be serious" but 2-3 months on it won't seem strange at all. Honest!

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

Re: missing java.net

I am running into the same situation and yeah my reaction is "they can't be serious!!!". It is so painful to have to go through each of the class and look for a similar one in blackberry, sometime there isn't a similar one either. I don't know how do you do it but I am about to give up with blackberry :smileysad:
Please use plain text.
Developer
dkonigs
Posts: 241
Registered: ‎07-25-2008
My Device: Bold 9900

Re: missing java.net

Just remember, regular J2ME doesn't have all the net.rim.* classes.  And seriously, those help fill in a lot of the gaps in what's missing, and add a lot of other useful stuff.  (Yet the regular J2ME world still shuns us because we're just a bit different, and would rather go back to their little world of semi-functional cell phones that take 20 minutes to start a Java app.)
Please use plain text.
Developer
redmapleleaf
Posts: 121
Registered: ‎11-29-2008
My Device: Not Specified

Re: missing java.net

Hi dkonigs,

 

I am still finding my way around the BB so if you don't mind I have some beginner questions. I am willing to use anything net.rim*, etc. as long as it leads to a solution:

 

1. How do you do UTF8 encode of a text string? In java SE they has something call URL.encode() for doing this.

2. How do you implement Map and Hastable as in java.util.Map and java.util.Hashtable?

 

I think I can stumble around and get the http connection working without the java.net but the above two is now a problem.

 

thank you for your help!

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

Re: missing java.net

See UrlEncodedPostData.

 

java.util.Hashtable is the same

 

java.util.map you'll have to re-invent

 

 

 

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

Re: missing java.net

UrlEncodedPostData works beautifully, thank you RexDoug. I am on a roll :smileyhappy:

 

Now could I ask another question: how do I setup the screen to display japanese characters?? I am trying to display a hello message and all that I got are boxes and question marks... 

 

 

Please use plain text.
Administrator
MSohm
Posts: 14,241
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: missing java.net

Support for languages that use non Latin based characters (i.e. Chinese, Japanese) are not supported in all versions of the BlackBerry Simulator.  You must use a BlackBerry Simulator that has a version of BlackBerry handheld software that supports these languages.

 

The BlackBerry Simulator download page will state if a particular version of the BlackBerry Simulator supports one of these languages. 

 

BlackBerry Simulator Download Page:

https://www.blackberry.com/Downloads/entry.do?code=060AD92489947D410D897474079C1477

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.