Results 1 to 5 of 5

Thread: Create a Text File with J2ME

  1. #1
    Join Date
    Mar 2010
    Posts
    360

    Create a Text File with J2ME

    Hello,
    I write a text (I use a laptop Touch2 HCT, Windows Mobile 6.5). For this, I must know the syntax for the path to write my file (the location of the file). Now I know it exists, for example, this syntax:
    Code:
    String picture ="fileconn.dir.photos"; String path = System.getProperty(photos);
    But this does not suit me because I would like to save to a folder that I created myself (and not a file system as "my pictures" for example). I wonder if there is another way to specify the path to save my file. Than you for your help.

  2. #2
    Join Date
    Apr 2008
    Posts
    264

    Re: Create a Text File with J2ME

    You can not read a txt file stored on the PC in a mobile application provided that you use a web service. Otherwise you can always put a txt file on the classpath (which will be integrated in the jad file) and read it directly in the same way you do for an image, you can be accessed by the term. Remember that supports Java ME java.io then read a txt file in mobile is like using the same classes that you can do with Destkop, the only difference is that the file location and access.

  3. #3
    Join Date
    Mar 2010
    Posts
    360

    Re: Create a Text File with J2ME

    I want to read a text file stored in the memory of my phone. You said, using a web service? FTP is that possible? I do not want to integrate the text file in the jar file. This text file will be updated on the phone all day so should be accessible. Exactly I went looking for the tree to get a file, located in a directory of mobile phone. But my problem is: what is the syntax of this tree? ?
    I tried:
    Code:
    file: / myFolder / myfile.txt
    file: / localhost / myFolder / myfile.txt
    file: / c: / myFolder / myfile.txt
    but in vain, I can not read a text file located on the mobile.

  4. #4
    Join Date
    Dec 2009
    Posts
    292

    Re: Create a Text File with J2ME

    The path is rather "file: / / localhost / myfile.txt"
    instead of one / you put / / (as protocol to access the file and not and not a path). You can access it by:
    Code:
     FileConnection fc = (FileConnection)
          Connector.open("file: / / localhost / test.txt");
    which trows FileNotFoundException, IOException etc. Do not forget to add the jad file the following permissions javax.microedition.io.Connector.file.write and javax.microedition.io.Connector.file.read. To save: Right click on the project ===> Application Descriptor ==> Api Permission. For those transactions which deserves to leave.

  5. #5
    Join Date
    Mar 2010
    Posts
    360

    Re: Create a Text File with J2ME

    I have made me the way you specified with the following code:
    Code:
    String url = "file: / / localhost / test.txt"; FileConnection fconn = (FileConnection)Connector.open(url, Connector.READ_WRITE);
    I add the two permissions:
    Code:
    javax.microedition.io.Connector.file.write
    javax.microedition.io.Connector.file.read
    It does not work. By cons when I put the following path:
    Code:
    String path = System.getProperty("fileconn.dir.photos");
    it returns me the path: file: / / / My Pictures / and it works. But as I explained in my first post, I want to give my own way and I can not.

Similar Threads

  1. Download File Explorer for J2ME phones for Free!
    By Rudra.J in forum Portable Devices
    Replies: 20
    Last Post: 09-10-2011, 09:37 AM
  2. How to convert image text into a text file
    By Wadee in forum Windows Software
    Replies: 5
    Last Post: 02-12-2010, 06:33 PM
  3. How to Create Button using J2ME Programming?
    By Samarth in forum Software Development
    Replies: 4
    Last Post: 20-01-2010, 10:17 PM
  4. Bluetooth File Transfer (OBEX FTP) J2ME
    By Leman in forum Networking & Security
    Replies: 2
    Last Post: 17-08-2009, 11:03 AM
  5. Reading text string from text file (PHP)
    By Moderate in forum Software Development
    Replies: 3
    Last Post: 16-01-2009, 03:27 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,205,413.51163 seconds with 17 queries