s60模拟器在mtj(eclipseME)中启动报错问题解决

MTJ(eclipseme)中使用s60的模拟器时,启动会报错:
Jar file could not be initialized.(invalid entry compressed size)

解决方法:
1.在[Run]->[Run Configuration]中MIDlet页的Executable选择JAD URL,填入相应jad文件的路径,如:D:workspacesMoFire.jad

2.Emulation页中的,Extra Emulator Parameters中填入:
-Xdescriptor:D:/workspaces/MoFire.jad

出处:
http://discussion.forum.nokia.com/forum/showthread.php?t=117158

how big should the byte array be in java me(j2me)

Keep getting the out of memory error when handling the image file in emulator(wtk) and device(e61i)
Just had a simple test and here is what I found:
The code is simple:
for(int i=1000;i<Integer.MAX_VALUE;i++){
System.out.println(i);
byte[] buf = new byte[i];
}
and see when your program will crash. – Actually it won’t crash, as the OOME(out of memory error), is an Error rather RuntimeException, when the OOME is thrown, the program just go on.

Let’s see the result:
In wtk2.5.2 emulator: the size cannot beyond “2003765” byte(for comparison: we can reserve byte array of size  Integer.MAX_INTEGER/40 – 53687091 in standard version on my laptop).
In e61i: not instrumented yet. My guess is maybe much smaller, as I had experience that OOME thrown when the image size is only 300k, what different is: the byte array CAN take up to that size, however error happened when handling the image(when trying to createImage from byte array).
I followed this thread and the guys found that 400k bytes is the limit on nokia6681.

Another depressing result.

Fire-j2me

Decided to use Fire-j2me as the UI engine, evaluated the API and felt good.This website www.bluevibe.net is author’s company which focuses on the Proximity Marketing(亲近营销,接近营销), the new word to me. Should elabrate it in another entry. Anyway, the idea is to do the marketing in the certain scenario with mobile devices equipped with bluetooth, blablabla…check this out:http://www.bluevibe.net/Mobile-Demos/
Initially, eSWT is prefered, however, there’s not much stuff in the Internet, and all I got from eclipse/eRCP official website is something like windows-ce runtime. God knows!
And LWUIT is not applicable, coz I did not feel it “light-weighted” and the worst thing is it does not support Chinese input.

Something from Fire’s readme:
===
Fire is a lightweight themable GUI engine for j2me MIDP2 applications. It is designed to be an eye-candy replacement to the traditional midp GUI components. It provides much more functionality than the midp standard components and its not kvm-implementation depended like the midp standard components.

Since v2.0 Fire also has an xHTML module that allows the creation of mobile browsers and GUIs based on xHTML. Fire also comes with a set of utility classes for logging, internationalization and more.
===

mofire的feedback

mofire的第一个feedback,谢谢大头佛同学
1、启动的时候有时反应蛮快的,有时却好像手机的按键失灵了,要多尝试几次才行。注,测试市手机没运行其他程序,内存也是空空的25M等待使用。
–这个问题一直都有,我的e61i上也有类似的问题。通常是要按两下才会启动。启动gmail客户端时候也有类似问题,应该是和手机有关。

2、能读取文章分类,可否在手机上也支持自定义分类呢?
–也就是可以随便添加新的分类?是可以做到的。

3、调用摄像头时,在摄像头窗口的下半部分的白色区域是什么意思的呢?我手机的分辨率是320*240
–这个就比较奇怪了,有可能是摄像窗口的代码有问题。

4、插入图片的时候出现错误java.lang.NullPointerException:0,载入背景图片和图片(pictures)都是同样的效果。我手机的背景图片存放在手机里面的(C盘),图片是存放在存储卡里面的(E盘)。
–这个问题困扰了我很久了,无法加入比640×480更大的图片,可以贴到blog上并能够发送。但是就是无法显示thumbnail图片。

5、也许插入图片、背景图片、录音剪辑、摄像头拍摄的照片这些在编辑正文的时候再插入会好些吧?在编辑文章标题、分类和标签的时候插入这些就不能再正文里面排版了。
–这个从一开始就没打算做,因为在手机那么小的屏幕里去排版本身就很麻烦。所以暂时还是把最主要的功能实现吧。而且界面的东西没有找到比较合适的框架。也许eSWT.

6、录音的格式是*.wav,文章发表到WordPress后用Firefox是打不开滴,不过这个应该不是需要moFire解决的问题了。
–这个要看一下。录音功能还很原始。

7、上传的照片在WordPress的媒体看里面是不能预览的,就是说,WordPress没有创建给上传的照片创建缩略图了。
–没有考虑过这个。

8、在读取用户数据、使用摄像头和使用网络链接的时候每次都请求允许,感觉有点烦哦。设置为第一次讯问会方便些吧!
–又是限制,这个是本身权限的问题,s60对java程序的限制很严格。但不确定签名之后会不会好点,没有测试过。尤其是使用文件操作的时候,确实很烦。

9、在发布文章的时候有时会出现错误java.lang.NullPointerException:0。我确定自己填写的用户名和密码什么的都是正确的。
–不稳定

10、现在没发现moFire和输入法冲突了,我测试了点讯输入法和搜狗输入法以及系统默认的输入法。
–可能是用了本地签名??也不清楚怎么就忽然可以用了。我之前的zta也是这样,后不知道怎么就好了。我还以为是因为的zta已经签过名了。

jme上的json和xml

由jme上的XMLrpc,很自然地想到JSON在JME平台上的应用和支持。
有一个很常见的想法是“Why whould you want to use JavaScript Object Notation? It was made for javascript, and not for java. ”,json来自javascript,但是它只是object notation,完全可以理解为一种描述性的markup语言,也就是和XML或者HTML同一个级别。
XMLhttp -> JSONhttp
XMLrpc ->JSONrpc
XML-jme ->JSON-jme

JSON的描述能力丝毫不逊于XML,而且没有XML那么多的繁复的标签,当然,牺牲的是可读性。因而JSON和XML适用的场合是不同的,XML更适合描述性的文档,但JSON更适合传输或者数据存储,因为省地方嘛。

参考:
SUN提供了一套开源的JSON for ME Java API
JSON on Java ME
XML和JSON的转换工具:

XML to JSON
JSON编辑器:
JSON editor

Nokia网站上的资源

pureMVC
http://wiki.forum.nokia.com/index.php/Model-View-Controller_Architecture
可以用于jme开发的MVC框架

nokia2008年的CallingAllInnovators比赛的获胜者,其中总冠军是来自中国的,居然一直都没听说过,Grand Prize: X Dancery,看了一下视频,震撼到了!
http://www.callingallinnovators.com/previous_winners.aspx

eSWT貌似s60的runtime一直都支持eSWT,怎么没怎么见有人用过呢?可能还是见的太少了。
http://wiki.forum.nokia.com/index.php/ESWT
eRCP是nokia的开源项目http://www.eclipse.org/ercp
    * eSWT:   The embedded Standard Widget Toolkit which is a subset of desktop SWT API. An eSWT implementation for Series 80 has been contributed. The development for s60 platform is in progress.
    * Core Runtime:   Eclipse Core which provides OSGI and Extension Point Framework support.
    * eJFace:   A set of classes which extend eSWT to: enable eRCP applications to integrate with an eRCP workbench, and provide more complex widgets like MVC oriented viewers.
    * eWorkbench:   A UI framework which supports multiple cooperative eRCP applications, and a generic Workbench which manages launching and display of eRCP applications.
    * eUpdate:   A simplified API and interface for dynamically updating device software.

How to use eSWT with Midlets
http://wiki.eclipse.org/How_to_use_eSWT_with_Midlets
Using eSWT and MMAPI together to take a picture in Java ME
http://wiki.forum.nokia.com/index.php/Using_eSWT_and_MMAPI_together_to_take_a_picture_in_Java_ME

Java Runtime 1.4 for S60 Release notes(目前只有N97)
http://wiki.forum.nokia.com/index.php/Java_Runtime_1.4_for_S60_Release_notes(支持触摸屏)

Java Runtime 1.3 for S60 Release notes(目前只有5800)
http://wiki.forum.nokia.com/index.php/Java_Runtime_1.3_for_S60_Release_notes

Java API Specifications
http://www.forum.nokia.com/Resources_and_Information/Documentation/Java/Java_API_Specifications.xhtml

System properties
http://wiki.forum.nokia.com/index.php/TSJ000306_-_MIDP:_System_properties

Java ME UI Frameworks
http://wiki.forum.nokia.com/index.php/Java_ME_UI_Frameworks

eclipseME报“Create process failed”的解决方法

在运行一个MIDlet时就是很简单一句:
Create process failed

看了一下wtk2.5.2/bin下有一个emulator.vm的文件,应该是被emulator.exe用来设置环境的模板文件,里面的其实是用java.exe运行emulatorWrapper。这里因为是直接copy过来用的,所以jdk的路径有问题,把java的路径改好就ok了。

写给搜索引擎和遇到相同问题的朋友。