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
Posts: 7
Registered: ‎10-08-2009
My Device: Not Specified

Java Tutorial - Blackberry

Hello,

Could you please let me know how to deploy a simple java program on Blackberry OS and make it run.

Thanks.
Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: Java Tutorial - Blackberry

First you should check the videos from Developer Video Library. You will get some idea.

http://na.blackberry.com/eng/developers/resources/videolibrary.jsp#tab_tab_deployment

 

Regards

Bikas

New Developer
Posts: 7
Registered: ‎10-08-2009
My Device: Not Specified

Re: Java Tutorial - Blackberry

 

Thanks a lot. But I couldn't find something that could tell step by step on how to deploy a java piece of code (for example - to configure proxy for internet requests) copied below. Please assist. 

 

- Create a socket connection to proxy.com like this:

 

SocketConnection proxy_connection = (SocketConnection)Connector.open( "socket://proxy.com:8080" );

 

- Create a StringBuffer with the header of a petition to google.com like this:

 

StringBuffer buf = new StringBuffer();

buf.append( "GET http://www.google.com HTTP/1.1\n" );

buf.append( "Host: http://www.google.com:80\n' );

buf.append( "Proxy-Authorization: Basic " + Base64Encode( proxyUsername + ":" + proxyPassword ) + "\n" ); // if is necessary

buf.append( "Content-Language: en-US\n" );
buf.append( "Connection: close\n" );
buf.append( "User-Agent: Profile/MIDP-2.0 Configuration/CLDC-1.0\n" );
buf.append( '\n' );

 

 

- Sent the header of request to the socket connection:

 

output_stream = proxy_connection.openOutputStream();  
input_stream = proxy_connection.openInputStream();
output_stream.write( buf.toString().getBytes() );
output_stream.flush();

 

- Finally, i read the response

 

message = new StringBuffer();

while ( ( readed_char = input_stream.read() ) != -1 ) {

     message.append( (char)readed_char );

}

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Java Tutorial - Blackberry

Have you looked at the sample programs that ship with the JDE?

 

 

 

 

Highlighted
New Developer
Posts: 22
Registered: ‎10-23-2008
My Device: Bold

Re: Java Tutorial - Blackberry

You can find a suite of tutorials to get you started at developerlife.com.

 

We also provide BlackBerry Bootcamp Training services if you are interested. Details are provide here.


Nazmul
President
ScreamingToaster