title: Connecting To a URL through java in Blackberry
body: <p>I am trying to connect to a URL through a Java program in Blackberry simulator. But it is not connecting.</p>
  
  <pre><code>   try { 
          HttpConnection httpConn;
          StreamConnection s;
          s = (StreamConnection)Connector.open("http://www.google.com/");
          httpConn = (HttpConnection)s;
          status = httpConn.getResponseCode();
  
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      int t=0;
      if (status == HttpConnection.HTTP_OK)
      {
          add(new RichTextField("Successfully Authorized", Field.NON_FOCUSABLE));
      }
  </code></pre>