×

Discussion Board

Results 1 to 3 of 3

Thread: JSR 75 Problem

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    36

    JSR 75 Problem

    Hi, I am usign netbeans 6.7.1 IDE and my sdk is java 6 update 14. I dont know why in FileConnection API I cant find he built in method create, mkdir, close and etc.

    Because I've tried this example.

    public void createFile() {
    try {
    FileConnection filecon = (FileConnection)
    Connector.open("file:///SDCard/mynewfile.txt");
    // Always check whether the file or directory exists.
    // Create the file if it doesn't exist.
    if(!filecon.exists()) {
    filecon.create();
    }
    filecon.close();
    } catch(IOException ioe) {
    }
    }


    and it seems that the compiler cannot find the method exists(), create() and close(). But I can use the import javax.microedition.io.*; which means I am using JSR 75 API. So I am wondering why I cant use this methods. because i need this.

    And also another question I used Nokia 6500 slide S40 OS and I install this, please refer to this code fragment:

    OutputConnection connection = (OutputConnection)
    Connector.open("file://c:/myfile.txt;append=true", Connector.WRITE );
    OutputStream out = connection.openOutputStream();
    PrintStream output = new PrintStream( out );
    output.println( "This is a test." );
    out.close();
    connection.close();
    Alert alert = new Alert("Completed", "Data Written", null, null);
    alert.setTimeout(Alert.FOREVER);
    alert.setType(AlertType.ERROR);
    display.setCurrent(alert);
    }
    catch( ConnectionNotFoundException error )
    {
    Alert alert = new Alert(
    "Error", "Cannot access file.", null, null);
    alert.setTimeout(Alert.FOREVER);
    alert.setType(AlertType.ERROR);
    display.setCurrent(alert);
    }
    catch( IOException error )
    {
    Alert alert = new Alert("Error", error.toString(), null, null);
    alert.setTimeout(Alert.FOREVER);
    alert.setType(AlertType.ERROR);
    display.setCurrent(alert);
    }


    When I tried to write a file in my phone, I got java.lang.SecurityException. I want to know the reason why? And is it possible in Nokia 6500 slide S40 to do this? like create directory? move and delete files? Thanks And by the way Nokia 6500 slide supports JSR 75. Any help will be greatly appreciated. Thank you so much.

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: JSR 75 Problem

    What comes to the Security Expression, note that you do not have full access to all files and directories on the phones
    http://library.forum.nokia.com/index...82070821D.html

    Hartti

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,087

    Re: JSR 75 Problem

    and it seems that the compiler cannot find the method exists(), create() and close(). But I can use the import javax.microedition.io.*; which means I am using JSR 75 API. So I am wondering why I cant use this methods. because i need this.
    Use import javax.microedition.io.file.*; // for using JSR 75 File connection Api's

    When I tried to write a file in my phone, I got java.lang.SecurityException. I want to know the reason why?
    On some device you may require to sign your app with JV or other 3rd party code signing certificate - and even then your midlet is allowed to access only some public paths and not all system paths for file operations.

    And is it possible in Nokia 6500 slide S40 to do this? like create directory? move and delete files? Thanks And by the way Nokia 6500 slide supports JSR 75
    Yes, All this is possible on N6500 slider - S40 device, it supports JSR 75 - refer to spec's http://www.forum.nokia.com/Devices/D...ns/6500_slide/
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

Similar Threads

  1. JSR-75 PIM Problem
    By nebuhcaneza in forum Mobile Java General
    Replies: 1
    Last Post: 2009-01-16, 04:15
  2. JSR - 75 API problem
    By j2meDev in forum Mobile Java General
    Replies: 8
    Last Post: 2007-06-14, 14:51
  3. jsr 75 problem in nokia OS
    By gamedeveloper in forum Series 40 & S60 Platform Feedback Archive
    Replies: 4
    Last Post: 2007-06-05, 09:50
  4. JSR-75 FileConnection api - problem
    By jcsjacekj in forum Mobile Java General
    Replies: 6
    Last Post: 2006-10-17, 04:23
  5. problem with JSR-75 with N-72
    By samir01m11 in forum Mobile Java General
    Replies: 3
    Last Post: 2006-09-05, 05:07

Posting Permissions

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