Tuesday, March 15, 2011

JavaMe Tips: Where is FileConnection API writing my files when using Emulator?

Last weekend when working on a FileConnection API request I realized that I didn't know where in my PC were the emulator saving the files I was creating, so I made a little research...

I know there are different kind of emulators, some of them have their own way to simulate the behavior of the sd cards from mounting a user directory to the use of default directories in user's profile.

The Emulators I was using were WTK 2.5.2 and JavaMe sdk 3.0 and I was working on Netbeans 6.9.1 and here is what I found.

For WTK 2.5.2:
Try looking in 

<Documents and settings>/<UserName>/j2mewtk/2.5.2/appdb/<TempDir>/filesystem

Where <TempDir> is a temporal directory that is created to hold all the files in runtime. Be careful, everytime you close the emulator the dirs are deleted, so make any validation you need before closing your emulator.

For JavaMe sdk 3.0:
Try looking in

<DocumentsAndSettings>/<UserName>/javame-sdk/3.0/work/<EmNum>/appdb/filesystem

Where <EmNum> is a number representing the Emulator you are using, for example, DefaultCldcPhone1 emulator is number 6.

see ya soon!

References:

How to test file reading/writing and web server app in emulator? 2008. Forum.Nokia [online].
Available on Internet: http://discussion.forum.nokia.com/forum/showthread.php?143733-How-to-test-file-reading-writing-and-web-server-app-in-emulator
[accessed on March 13 2011].