Read a txt file from MIDlet

dear sir,
I am working on a midlet which should read position information (privided by TOMTOM GPS) from a TXT file and send it to a server.
In Toolkit everything works fine, but when I transfered the midlet on a ipaq pocket pc running windows and using IBM j9 jvm I got problems.
I can not read any file which is not in the package of the MIDlet
here is the code:
//read position from textfile
try {
Class c = this.getClass();
InputStream is = c.getResourceAsStream("iamhere.txt");
StringBuffer str = new StringBuffer();
byte b[] = new byte[1];
while ( is.read(b) != -1 ) {
str.append(new String(b));
is.close();
position = str.toString();
catch (Exception e) {
e.printStackTrace();
position = new String("Sorry: I can not read position of your friend!");
can it be that this operation is generally not allowed or that the path is not correct (i tryed also file:///java/iamhere.txt)
thanks for any help
dominik

hi,
this works fo me:
download ibm websphere trail from IBM website.
install websphere andwebsphere everyplace on the pocket pc
in the websphere program there is a update tool
launch it and download and install fileconn.dll pimdll.dll
(I do not remember how it is called but something like jsr 75 or fileconnector or fc)
� Copy E:\WSDD\wsdd5.0\ive-2.2\runtimes\wm2003\arm\midp20\bin\j9.exe to
\Program Files\J9\MIDP20\bin\
� Copy
E:\WSDD\wsdd5.0\ive-2.2\runtimes\wm2003\arm\midp20\bin\fileconn.dll to
\Program Files\J9\MIDP20\bin\
� Copy E:\WSDD\wsdd5.0\ive-2.2\runtimes\wm2003\arm\midp20\bin\pimdll.dll
to \Program Files\J9\MIDP20\bin\
� Copy jars from
E:\WSDD\wsdd5.0\ive-2.2\runtimes\wm2003\arm\midp20\lib\jclMidp20\ext\ to
\Program Files\J9\MIDP20\lib\jclMidp20\ext\
and in the JAD:
MIDlet-Permissions:
javax.microedition.io.file.read,javax.microedition.io.file.write
hope this helps.
Ciao

Similar Messages

  • Help reading a .txt file from the hard drive....

    Hi guys,
    Ok... I need to know how to read a .txt file from the hard drive... I have an example on how to read from a disk, but I don't have a disk drive. I could be confusing terminology, but I don't think I am. Here is the code I have for reading from a disk.. please let me know how I should change it to read from a hard drive.
    Also, when the error pops up, it says that it can't read another .txt file that is not specified in the code... any ideas how that is occuring? Please advise.
    import java.io.*;
    public class TEST {
    public static void main(String args[]) throws Exception{
    FileReader fr = new FileReader("customer.txt");
    BufferedReader bfr = new BufferedReader (fr);
    String s;
    while ((s=bfr.readLine())!= null){
    System.out.println (s);
    fr.close();
    }

    Ok... I need to know how to read a .txt file from the
    hard drive... I have an example on how to read from a
    disk, but I don't have a disk drive. I could be
    confusing terminology, but I don't think I am. Here
    is the code I have for reading from a disk.. please
    let me know how I should change it to read from a
    hard drive.The code will be the same, regardless of where the file is located. It's just the filename that will be different.
    Also, when the error pops up, it says that it can't
    read another .txt file that is not specified in the
    code... any ideas how that is occuring? Please
    advise.Probably becuase the class file (compiled version of the source code) is a different version to the source code, i.e. the source code hasn't been recompiled since the source code was changed.
    How does this relate to EJBs?

  • How to read LARGE .TXT FILES from server

    i m unable to read large .txt (>100kb) files from server.
    also is there any way to store the content in mobile phone.
    PLEASE HELP as iam in dire need and only few days are left.
    thanks

    Hi
    > i m unable to read large .txt (>100kb) files from server.
    What do you mean by that? Are you trying to display that amount of text and you get an error. Are you trying to read from the server and you get there an error?
    > also is there any way to store the content in mobile phone.
    Using RMS. But be aware of the size limit specific to every phone.
    Mihai

  • Reading a Txt file from SDCard...advise sought.

    Hey,
    Just a quick post to see if any of you kind people would be able to help me out here. I'm intending to have a database (simply perhaps as just text in a .txt file) stored on my SDCard on my Palm and want to be able to read in that file and in turn check the data. I'm not sure in which the best way to go about this using File Connection reader.
    I can already browse the SDCard via my app, but I want to be able to have decisions based on the data within the file, such as updating choicegroups based on the contents.
    Is there anyone out there with advise, or know's of link's to Tutorials/Sample Code/etc which might be of help?! Thanking you sooooo much in advance.
    Regards,
    Cam

    Thanks!
    Is there any kind of Import I should use with this code that with out might throw up these errors: Heh. I tried integrate that into my code you see, to a certain extent...!!
    Building "Project"
    h:\wtk\Project\src\Project.java:405: cannot find symbol
    symbol : variable read
    location: class javax.microedition.io.Connector
              FileConnection fc = (FileConnection)Connector.open("file:///SDCard/actype.txt",Connector.read);
    ^
    h:\wtk\Project\src\Project.java:406: java.io.InputStream is abstract; cannot be instantiated
                   InputStream is = new InputStream(fc.openInputStream());
    ^
    h:\wtk\Project\src\Project.java:407: cannot find symbol
    symbol : class StringBugger
    location: class Project
                   StringBugger sd = new StringBuffer();
    ^
    h:\wtk\Project\src\Project.java:411: cannot find symbol
    symbol : variable sb
    location: class Project
                   sb.append((char)ch);
    ^
    4 errors
    com.sun.kvem.ktools.ExecutionException
    Build failed
    Not cool :(!
    Thank's in advance!

  • Reading a TXT file from a Flash Movie

    Using "LoadVariables" to establish a connection between the
    running Flash program and a text file in the same folder works just
    as expected with no problems. I am on a Windows machine and using
    the recipe from the fabulous help system.
    The problem - yes there IS a problem - arises when the text
    file contains special Danish characters.
    The odd part here is, that everything works fine from inside
    Falsh using "Test Movie", but not when publishing the movie and
    launching from inside a browser (both IE and Firefox).
    The help system says, that data should be URL-encoded. Trying
    that (characters %e6, %f8 and %e5) does not fix anything. The input
    is read, but the offending character is gobbled up along with the
    two next characters, or the program simply hangs.
    Any suggestions?[

    No i didn't do that in my first series of tries. Following
    your suggestion I did that (embedding Latin I, that should contain
    all the necessary characters), but it didn't do the trick. Actually
    it prevented my writing to a dynamic text field intended to
    interact with the user.
    Using English cahracters only it worked fine (with invisible
    text ;-) ).
    Using Danish characters I got the same result: Not working
    properly.
    Using the Danish characters from inside Flash to fill in text
    fields (static, dynamic and input) normally works fine, so I am
    puzzled - still

  • Reading .txt file from remote using abap?

    Hi,
    I must read a .txt file from remote server automatically.
    I have path and name of .txt file. Remote system asks username and password.
    In abap is it possible to give username and password for reading .txt from remote server?
    Remote server and sap server are not in same domain.
    How can i do that?
    Thanks.

    Hi Cemil ,
      You can try using the FM RZL_READ_FILE_REMOTE_SH.
    This is an option i found ,  but i have really not tried it out .
    Regadrs
    Arun

  • "Bad data format" when reading txt file from the presentation server

    Hello,
    I have a piece of code which reads a txt file from the presentation server to an internal table like below:
    DATA : lv_filename type string.
    lv_filename = 'C:\abap\Test.txt'. "I created a folder called abap under C:\
    CALL method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
    EXPORTING
       FILENAME              = lv_filename
    CHANGING
       DATA_TAB            = lt_tsd. " lt_tab has the exact same fields as the Test.txt's. Test.txt has only one line, tab delimited.
    When running this code, exception BAD_DATA_FORMAT is issued.
    Is it because of the file encoding or delimiter or other reason?
    Thanks,
    Yang

    Hello,
    If its tab delimited then use the has_field_seperator parameter and check
    DATA : lv_filename type string.
    lv_filename = 'C:\abap\Test.txt'. "I created a folder called abap under C:\
    CALL method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
    EXPORTING
       FILENAME                = lv_filename
       FILETYPE                 = 'ASC'
       HAS_FIELD_SEPARATOR          = u2018Xu2019
    CHANGING
       DATA_TAB            = lt_tsd.
    Vikranth

  • Need to copy .txt file from FTP server and downloaded on local server directory.

    I need to figure out a way to copy .txt file from ftp server in local server directory using sql jobs.

    Below links will help achieving it:
    https://www.virtualobjectives.com.au/sqlserver/ftp_scripts.htm
    http://www.mssqltips.com/sqlservertip/2884/sql-server-integration-services-ssis-ftp-task-for-data-exchange/

  • Reading a text file from a URL

    I am having problems trying to read a text file from a URL.
    This is the code i have been using:
    package Java;
    import java.net.*;
    import java.io.*;
    public class Main_1 {
    public static void main(String[] args) throws Exception {
         URL myAddress = new URL("http://www.geocities.com/simonrobinson1/java/farrago.txt");
         BufferedReader in = new BufferedReader(
                        new InputStreamReader(
                        myAddress.openStream()));
         String inputLine;
         while ((inputLine = in.readLine()) != null)
         System.out.println(inputLine);
         in.close();
    but it returns an error saying:
    java.net.NoRouteToHostException: Operation timed out: no further information
    at java.net.PlainSocketImpl.socketConnect(Native Method) .....etc etc.
    Is this just a problem due to my network or is there something wrong with my code ????

    Altho you can access the file by typing the URL in a browser, geocities being a free web-hosting service don't like you to access the materials without seeing their ads. You have to find a way to trick it into thinking that you are indeed coming in from a web browser even tho you aren't.
    V.V.

  • How can i read only .txt file and skip other files in Mail Sender Adapter ?

    Hi Friends ,
                       <b> I am working on scenario like , I have to read an mail attachement and send the data to R3.</b>
                        It is working fine if only the .txt file comes.
                      <b>Some times ,html files also coming along with that .txt files. That time my Mail adapter fails to read the .txt file.</b>
                       I am using PayLoadSwap Bean and MessageTransformBean to swap and send the attachment as payload .
                         <b>Michal as told to write the Adapter module to skip the files .But i am not ware of the adapter moduel . If any blogs is there for this kind of scenarios please give me the link.</b>
                           Otherwise , please tell me how to write adapter module for Mail  Sender Adapter?
                      How to download the following
                        newest patch of XI ADAPTER FRAMEWORK CORE 3.0
    from SAP Service Marketplace. Open the file with WinZip and extract the following
    SDAs:
    &#61589;&#61472;aii_af_lib.sda, aii_af_svc.sda
    &#61589;&#61472;aii_af_cpa_svc.sda
                        I have searche in servive market place .But i couldn't find that . Can you please provide me the link to download the above .
                      If any other suggestions other than this please let me know.
    Regards.,
    V.Rangarajan

    =P
    Dude, netiquette. Messages like "i need this now! Do it!" are really offensive and no one here is being payed to answer anyone's questions. We're here because we like to contribute to the community.
    Anyway, in your case, just perform some search on how you could filter the files that are attached to the message. The sample module is just an example, you'll have to implement your own. Tips would be to query the filename of the attachments (or maybe content type) and for the ones which are not text, remove them.
    Regards,
    Henrique.

  • Sample code to read a text file from UNIX directory.

    I am using 9i Developer Suite, application server is 9.0.4. I want some help on how to read a flat file from UNIX environment. A sample code could be very helpful.
    In windows, i use this kind of code:-
    I declare an object & then write to a file using these sample staements:-
    file_handle text_io.file_type;
    filename := 'd:\ran\egs\uninvoiced.txt';
    file_handle:=text_io.fopen(filename,'w');
    text_io.put_line(file_handle, 'MOBILE NO '||'COUPON NO ' || 'DATE');
    I hope, my question is clear. Please help in solving the doubt.
    Regards.

    filename := 'd:\ran\egs\uninvoiced.txt';This is a Windows directory, so it won't work on Unix.
    For the rest of the code: see examples in the Forms Builder Online Help.

  • Interesting ? @ servlet reading a txt file

    hi friends,
    i need ur help for one interesting problem i m facing.
    I want to read a txt file and wanna display the text from that file into an html, using a servlet.A txt file contains sentences( words with spaces in between ).When servlet reads the file, it is reading the whole sentence ,but while displaying that sentence, it is just showing the first word of the sentence.
    html is not able to read the space between the words.
    so what do i suppose to do now.
    waiting for ur replies.......
    thanx
    amit

    hi friends ,
    i m giving the code , just give it a try//
    This is a servlet ---------------------------------------
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class AdminGraphServlet extends HttpServlet
    Properties ht;
    FileInputStream fin;
    FileOutputStream fout;
    String s15,st;
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException,ServletException
    ht = new Properties();
    try
    fin = new FileInputStream("Data.txt");
    catch(FileNotFoundException e)
    System.out.println("FileNotFound");
    try
    if(fin != null)
    ht.load(fin);
    s15 = (String)ht.get("title");
    fin.close();
    catch(IOException e)
    System.out.println("Error Reading File");
    PrintWriter out = res.getWriter();
    res.setContentType("text/html");
    out.println("<html><body>");
    out.println("<form method=post action=http://localhost:8080/servlet/MyServlet>");
    out.println("<table><tr>");
    out.println("<tr><td>Title</td>");
    out.println("<td><Input Type=Text name=title value="+ s15 +"> </td></tr>");
    out.println("</table>");
    out.println("<input type=submit name=submit value=submit>");
    out.println("<input type=hidden name=check value=save>");
    out.println("</form>");
    out.println("</body></html>");
    public void doPost(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
    String Scheck = req.getParameter("check");
    PrintWriter out1 = res.getWriter();
    String ttl = req.getParameter("title");
    if(Scheck.equals("save"))
    ht.put("title",ttl);
    fout = new FileOutputStream("Data.txt");
    ht.store(fout,"Data");
    fout.close();
    out1.println("<html><body>");
    out1.println("<h1>Stored This Data Successfully</h1>");
    out1.println("</html></body>");
    txt file is having a line
    title=Are you smart enough?
    The servlet should display this sentence in a text box.
    But it is displaying only "Are".
    still waiting...
    have nice time..
    amit

  • How to Read a CAB File from JAVA?

    Hi,
    Anyone knows how to read a CAB File from java. I need to read a property file of txt file that is packaged in CAB file & then based on that, I have to do processing. Is there anyway to do it.
    I had tried using java.util.zip.ZipFile Class, but it does work for JAR, but not for CAB.
    siva.

    Perhaps there's something in the Cabinet SDK that will help:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncabsdk/html/cabdl.asp

  • Issues loading .txt files from server...

    Hi.
    I have an issue with a script I created that loads text strings from a file on my server.
    The swf file loads a message from a .txt file, displays it in an animation when the animation finishes it loops back to the start and loads the next message and displays it in the animation.
    All works fine. However the script reads the text file from the server on every loop ( 3 seconds ) This will be hard on my server so... Is there a way to read the text file once only and then loop through the eight statements?
    Thanks. Z
    Actionscript 2. Flash CS3. Flash Player 10.
    quotes.txt - text file containing eight quotes
    quote_txt - Dynamic field within animation
    ranQuote = new LoadVars();
    ranQuote.onLoad = function(success) {
        if (success) {
            RanNum = RanNum+1;
            if (RanNum>=9) {
                RanNum = 1;
                ran = this["quote"+(RanNum)];
                quote_txt.text = ran;
            } else {
                ran = this["quote"+RanNum];
                quote_txt.text = ran;
        } else {
            quote_txt.text = "Display if can't load txt file";
    ranQuote.load("quotes.txt");

    Unless I'm missing something, each time you load the file you are loading the entire file.  So you should have all of what's in it stored.  Your load function appears to just be picking out one of them out randomly after they're all loaded.
    I assumed wrongly that this isn't all the code you have and other loading code is what you are trying to inhibit.
    What you probably want to do is take most of your onLoad code and place it into a function.  What you have that is pulling up the quotes should utilize that function.  You shouldn't be using that loading code each time some button or whatever loop cycles.

  • Continiously read a txt file

    Hello fellows,
    is there a way to read a *.txt file continiously without doing the simple while loop wich burns all the CPU ??
    This txt file is generated by another application that pick up messages from a pipe and register messages in the txt file.
    As a final goal the messages read in the txt file will control other executions in the vi.
    Attached files: vi in LabVIEW 8.0 and the txt file.
    Attachments:
    Zip.zip ‏6 KB

    Thanks for your interest ! !
    The process will be as follows:
    1-an application reads text in a serveur pipe and write it into the txt file.
    2-The LabVIEW vi reads in loop the txt file and sort out the txt value each time that's updated by the application running in parralel.
    The goal is to synchronize the labview execution with the new messages arriving in the txt file.
    Thanks for your suggestions on how can I continiously read the txt file and take an action in the vi each time the txt file is updated with new text.
    See you...

Maybe you are looking for

  • Apple Video Adapter / Firewire Out Thru Camera

    Hello, Could someone explain in somewhat technical detail the difference between playing your timeline out to a TV, through the Video Adapter as compared to Firewire out thru a camera. I didn't own a TV - I only watch films on my wall with a projecto

  • Dbhelp error in win98 while using java

    Hi everyone, i am trying to write a screen capture program using Robot class and i have an error while not only woking with my project but also working with any other Applet or application. The error is as followed : An error occured.Dbhelp error! it

  • Discount Taken report

    I'm looking for a report that shows, by payment run, what discounts were taken and/or missed. Does anyone know an existing report or query that will provide this?

  • Feature Request - Make it run without crashing

    I have two windows computers running XP SP2. Bridge used to run fine on both and now will not keep running on either. It opens, sits there and will see pictures on my C drive, but the a few seconds after I select another internal drive, it crashes wi

  • How to reduce size of a database

    Hi, i have inserted too much data in my database 9i Lite, i drop a lot of them but the size of my .odb do not change. How i can do to re-estimate the size of my .odb (it reaches 5 Mo that is too much for a pocket PC) thanx for any answers Arnaud.