×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    reading Data from an HTTP Connection

    I tried to read Data from an HTTP Connection as a first time.
    But it does not work.
    The message is
    javax.microedition.io.ConnectionNotFoundException: Could not resolve hostname

    I tried to open http://www.jimkeogh.com/index.htm. that is the web site really exist.
    What steps I have to do?

    Code:
    StreamConnection connection;
    		try {
    			connection = (StreamConnection)Connector.open("http://www.jimkeogh.com/index.htm");
    			
    			InputStream in = connection.openInputStream();
    			StringBuffer buffer = new StringBuffer();
    			int ch;
    			while (( ch = in.read()) != -1)
    			{
    			if (ch != '\n')
    			{
    			buffer.append((char) ch);
    			}
    			else
    			{
    			System.out.println(buffer.toString());
    			buffer.delete(0, buffer.length());
    			}
    			}
    			
    
    
    		} catch (IOException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    		
    
    
    	}

  2. #2
    Registered User
    Join Date
    Jul 2009
    Posts
    29

    Re: reading Data from an HTTP Connection

    Hi Komomo,

    Please see this link for make connection in j2me http://www.java2s.com/Code/Java/J2ME/HttpConnection.htm

  3. #3
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    Re: reading Data from an HTTP Connection

    What I wrote is from the book and it is the first program of that chapter.
    I just want to test whether I could access the Internet from my program.
    Is there anything wrong in the program or do I need to do other steps?

  4. #4
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    Re: reading Data from an HTTP Connection

    Can I test that with the emulator?

  5. #5
    Registered User
    Join Date
    Jul 2009
    Posts
    29

    Re: reading Data from an HTTP Connection

    Quote Originally Posted by komomo View Post
    Can I test that with the emulator?
    Yes, please do it and let me know the result

  6. #6
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    Re: reading Data from an HTTP Connection

    What I have to do?
    I am saying that I can't do that.
    How I have to do?

  7. #7
    Registered User
    Join Date
    Jul 2009
    Posts
    29

    Re: reading Data from an HTTP Connection

    Quote Originally Posted by komomo View Post
    What I have to do?
    I am saying that I can't do that.
    How I have to do?
    Please tell me more about your environtment that you are working on
    - IDE you are using for develop
    - the device that your app will be run on nokia, blackberry...
    - model of your device...
    -

  8. #8
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    Re: reading Data from an HTTP Connection

    I am using eclipse-pulsar-galileo-win32.
    java(TM) ME platform SDK 3.0 is used.
    The emulator is Defaultcldcphone2.
    I have no real device to test.

  9. #9
    Registered User
    Join Date
    Jul 2009
    Posts
    29

    Re: reading Data from an HTTP Connection

    Hi,
    I know that eclipse is great IDE but you have to find J2ME plugin for your eclipse IDE so for easy to instruction you i suggest you to download and install Netbeans then i will follow and help you to build J2ME app. OK
    Download netbeans IDE here http://netbeans.org/downloads/start....en&option=java

  10. #10
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    Re: reading Data from an HTTP Connection

    I cann't access the web site u point out.
    The website declined to show this webpage

  11. #11
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    Re: reading Data from an HTTP Connection

    Have you got what I meant.
    I cannot download netbeans.
    in eclipse, the local host is ok.
    Is there any step to access from the internet?

  12. #12
    Registered User
    Join Date
    Jul 2009
    Posts
    29

    Re: reading Data from an HTTP Connection

    Please follow this to install j2me plugin for your eclipse IDE
    1. From the eclipse IDE go to Help->Install New Software...

    2. Cick on Add... button to add the url for install plugin for J2ME
    Name : eclipseme.org
    Location : http://www.eclipseme.org/updates/

    3. Config J2ME platform (you have installed version 3.0) with eclipse using Platform Components
    Window-->Preferences-->J2ME-->Device Management then Import the J2ME SDK 3.0 for Eclipse

    4. Open your project then create an J2me environtment to run the J2me app

  13. #13
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: reading Data from an HTTP Connection

    Before you change your working environment let me tell you that this is issue with the URL and hence the exception was thrown.

    Why dont you use the demo URL like the http://www.forum.nokia.com and test the results.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  14. #14
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    Re: reading Data from an HTTP Connection

    I have tested that URL.
    But it does not work.

  15. #15
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    Re: reading Data from an HTTP Connection

    I have also added as quangndba said.
    There is an error message when I add as he said.
    But I don't remember the message.
    To show u that message, when I add new s/w again, it said that it is duplicate.

    And there is still javax.microedition.io.ConnectionNotFoundException: Could not resolve hostname

Similar Threads

  1. Janus Symbian HTTP Engine reading POST data
    By sandy_1click in forum Symbian
    Replies: 0
    Last Post: 2009-08-27, 09:02
  2. Passing data through Http connection
    By devdattac in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2008-12-05, 05:06
  3. To retrieve data from server which connection is better socket or http connection.
    By Basu in forum Symbian Networking & Messaging (Closed)
    Replies: 8
    Last Post: 2008-08-07, 14:05
  4. Nokia S40 series- Http data reading Exception
    By pollux.java in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2008-06-25, 09:33
  5. Can't get data from http connection
    By rebeljack in forum Mobile Java General
    Replies: 3
    Last Post: 2003-10-12, 04:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×