×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    2

    Cannor read file with 6131 NFC SDK

    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
    Join Date
    May 2007
    Location
    Mexico D.F
    Posts
    351

    Re: Cannor read file with 6131 NFC SDK

    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
    Join Date
    Jan 2009
    Posts
    2

    Re: Cannor read file with 6131 NFC SDK

    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
    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
  •  
×