Canned Responses?

I want to use the I/O library routines for development -- primarily the File reading and writing classes. However, they are not including with the KVM distribution. So I decided to try importing them into a different library and including their dependent files along with them. When I compiled them, all went well, but when I ran them, I got an error about one of the native methods. Here's the code for the call:

MyPackage.BufferedReader bfe =null;

if (debug) System.out.print("Opening file... ");

try{

bfe =new MyPackage.BufferedReader(new MyPackage.FileReader("file.txt"));

catch (FileNotFoundException fnfe){

System.out.println("File not found. Using defaults");

}

//Rest of code

The code runs up to the line where the reader is defined (new MyPackage.....) and it fails with the error message:

Opening file... ALERT: Native method'MyPackage/FileInputStream::initIDs' not found.

Execution completed successfully

{Other technical stuff}

Is there a way in which I can use the File I/O classes because at the moment, I'm typing in all the data by hand each and every time I run my MIDlet which is not good for my fingers. And I don't want to hard code it into the MIDlet because that means I need to recompile each time I want to change the data and changing a file is much easier than changing the source code and recompiling.

(BTW: I've tried many different workarounds for this problem, but each one fails.)

Thanks in advance for any help.

PS: I know the KVM was designed for low-spec constrained machines, but I was just wondering if there is any way I can prevent my hands from contracting RSI before I finish this program... ;-)

Johnny

[2291 byte] By [johnnyooi] at [2007-9-26 11:06:30]
# 1

Is it that you are trying to get the emulator to read a file which exists in your operating system? If so, it cannot be done as direct as importing the J2SE class files, these classes will ultimately hit the base level OS (Windows, Linux, etc.) API, which in KVM will not exist, and you will get a native method not found error.

Another way of doing this is to write a J2SE server app which listens on a socket, and then your KVM app will act as a client, connect to the server socket, then your server can read the Window/Linux file and send it over the socket.

Good luck.

Don

d1camero at 2007-7-2 0:00:15 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

> Another way of doing this is to write a J2SE server

> app which listens on a socket, and then your KVM app

> will act as a client, connect to the server socket,

> then your server can read the Window/Linux file and

> send it over the socket.

Looks like that's the only way. I'll try that. Thanks for your advice.

Johnny

johnnyooi at 2007-7-2 0:00:15 > top of Java-index,Java Mobility Forums,Java ME Technologies...