Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User gwozdziu's Avatar
    Join Date
    Jan 2009
    Posts
    2
    Im a n00b with mobile Java and wold like to ask you all for help.
    I use Eclipse 3.4.1 with eclipseME. I use Nokia 6131 NFC SDK (ver. 1.1).

    I encountered following problem. While trying to read a file I constanly get NullPointerException ( run this in the emulator in Real Life security level).

    My code:
    Code:
    /**
     * 
     */
    package main;
    
    import java.io.IOException;
    import java.util.Enumeration;
    
    import javax.microedition.io.Connector;
    import javax.microedition.io.file.FileConnection;
    import javax.microedition.io.file.FileSystemRegistry;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    
    //import tagreading.TagFoundListener;
    
    /**
     * @author Grzegorz Gwozdz
     */
    public class NFCMIDlet extends MIDlet {
    
    	private Display display;
    
    	/**
             * 
    	 */
    	public NFCMIDlet() {
    		display = Display.getDisplay(this);
    	}
    
    	/**
    	 * @see javax.microedition.midlet.MIDlet#destroyApp(boolean)
    	 */
    	protected void destroyApp(boolean unconditional)
    			throws MIDletStateChangeException {
    	}
    
    	/**
    	 * @see javax.microedition.midlet.MIDlet#pauseApp()
    	 */
    	protected void pauseApp() {
    
    	}
    
    	/**
    	 * @see javax.microedition.midlet.MIDlet#startApp()
    	 */
    	protected void startApp() throws MIDletStateChangeException {
    		
    		System.out.println("FileConnection ver.:"+
    			System.getProperty("microedition.io.file.FileConnection.version"));
    		
    		Enumeration roots = FileSystemRegistry.listRoots();
    		while(roots.hasMoreElements()){
    			System.out.println(roots.nextElement());
    		}
    		
    		try {
    			FileConnection fileConnection = 
    				(FileConnection)Connector.open("file:///e:/");		
    			
    		} catch (IOException ex) {			
    			ex.printStackTrace();
    		} catch (NullPointerException e){
    			System.out.println("Error:"+e.getMessage());
    			e.printStackTrace();
    			
    		}
    	}
    }
    This is what i get in the concole:
    Emulator command: E:\Nokia\Devices\Nokia_6131_NFC_SDK_1_1\bin\midp.exe -Xdescriptor "C:\DOCUME~1\marta\USTAWI~1\Temp\_eclipseme.tmpmarta\NFCTest4791668885001017552.launch\NFCTest.jad"
    FileConnection ver.:1.0
    c:/
    e:/
    Error:null
    java.lang.NullPointerException

    Fancy, same code (with 'e:' switched to 'root1') works fine with Sun Java Wireless Toolkit 2.5 for CLDC emulator).

    Can you please tell me what i am doing wrong?

  2. #2
    Nokia Developer Expert rdrincon's Avatar
    Join Date
    May 2007
    Location
    Mexico D.F
    Posts
    351
    Hello

    1.

    What if you use Nokia Specific Directories

    http://library.forum.nokia.com/index...6BF_cover.html

    2.

    What phone are you using
    :Ruben

  3. #3
    Registered User gwozdziu's Avatar
    Join Date
    Jan 2009
    Posts
    2
    Not yet the real device So far im using the emulator provided with Nokia 6131 NFC SDK.

Similar Threads

  1. Contacts fields order??
    By timatima in forum Symbian C++
    Replies: 1
    Last Post: 2007-06-08, 13:51
  2. FAIL: Nokia 6131 NFC SDK from command line
    By dlopez in forum Near Field Communication
    Replies: 1
    Last Post: 2007-05-23, 13:19
  3. Replies: 1
    Last Post: 2005-05-26, 14:22
  4. Series 60 Concept Emulator (SDK Beta 0.2 Linux) not working
    By mattbee in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2003-06-10, 11:43
  5. Replies: 0
    Last Post: 2002-06-10, 12:24

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved