向高手求救,模拟器自动关闭问题

ivsking 2004-10-28 05:15:57
//canvas类里面paint函数内

......
System.out.println(position);//调试
try{
ani=new AnimatedImage(this,plane[commandchID/4][commandchID%4],position);//出问题
ani.start(g);//出问题

}catch (Exception e)
{System.out.println(e+"Animate");}

......
将出问题的两行注释了后,程序运行正常。
但不注释时,模拟器自动关闭,,还有就是无法扑捉这两行的异常。
另外传入的参数可以用 System.out.输出。
环境:J2SDK1。4。2,wtk2.1出错信息如下
Method............: df8374 'Gamescreen.paint (virtual)'

Stack Chunk.......: d80a3c

Frame Pointer.....: d80bb4

Current IP........: df7756 = df75c8 + offset 398

Previous Frame....: d80b84

Previous IP.......: 10151c4a (offset 80)

Frame size........: 6 (2 arguments, 4 local variables)

Argument[0].......: d83ae4

Argument[1].......: d806e4

Local[2]..........: dee9f4

Local[3]..........: dee9e0

Local[4]..........: dee2b4

Local[5]..........: d80b98

Operand[1]........: d83ae4



Method............: 100ec7cc 'javax/microedition/lcdui/Canvas.callPaint (virtual)'

Stack Chunk.......: d80a3c

Frame Pointer.....: d80b84

Current IP........: 10151c4a = 10151bfa + offset 80

Previous Frame....: d80b54

Previous IP.......: 1014a6e3 (offset 78)

Frame size........: 6 (3 arguments, 3 local variables)

Argument[0].......: d83ae4

Argument[1].......: d806e4

Argument[2].......: 0

Local[3]..........: d816f0

Local[4]..........: b2

Local[5]..........: d80b54



Method............: 100e73dc 'javax/microedition/lcdui/Display.repaint (virtual)'

Stack Chunk.......: d80a3c

Frame Pointer.....: d80b54

Current IP........: 1014a6e3 = 1014a695 + offset 78

Previous Frame....: d80b18

Previous IP.......: 1012c54b (offset 14)

Frame size........: 9 (6 arguments, 3 local variables)

Argument[0].......: d83bd0

Argument[1].......: 0

Argument[2].......: 1

Argument[3].......: b4

Argument[4].......: b2

Argument[5].......: 0

Local[6]..........: d83ae4

Local[7]..........: d816fc

Local[8]..........: d80a3c



Method............: 100d5a44 'javax/microedition/lcdui/Display$DisplayAccessor.repaint (virtual)'

Stack Chunk.......: d80a3c

Frame Pointer.....: d80b18

Current IP........: 1012c54b = 1012c53d + offset 14

Previous Frame....: d80ae8

Previous IP.......: 1014cdd0 (offset 16)

Frame size........: 6 (6 arguments, 0 local variables)

Argument[0].......: d83bb8

Argument[1].......: 0

Argument[2].......: 1

Argument[3].......: b4

Argument[4].......: b2

Argument[5].......: 0



Method............: 100e90f0 'javax/microedition/lcdui/Display$DisplayManagerImpl.repaint (virtual)'

Stack Chunk.......: d80a3c

Frame Pointer.....: d80ae8

Current IP........: 1014cdd0 = 1014cdc0 + offset 16

Previous Frame....: d80ab8

Previous IP.......: 1014e745 (offset 25)

Frame size........: 6 (6 arguments, 0 local variables)

Argument[0].......: d811f8

Argument[1].......: 0

Argument[2].......: 1

Argument[3].......: b4

Argument[4].......: b2

Argument[5].......: 0



Method............: 100ea50c 'com/sun/midp/lcdui/DefaultEventHandler.repaintScreenEvent (virtual)'

Stack Chunk.......: d80a3c

Frame Pointer.....: d80ab8

Current IP........: 1014e745 = 1014e72c + offset 25

Previous Frame....: d80a80

Previous IP.......: 1014e037 (offset 775)

Frame size........: 8 (6 arguments, 2 local variables)

Argument[0].......: d80d90

Argument[1].......: 0

Argument[2].......: 1

Argument[3].......: b4

Argument[4].......: b2

Argument[5].......: 0

Local[6]..........: d80d84

Local[7]..........: d80d30



Method............: 100e9e14 'com/sun/midp/lcdui/DefaultEventHandler$QueuedEventHandler.run (virtual)'

Stack Chunk.......: d80a3c

Frame Pointer.....: d80a80

Current IP........: 1014e037 = 1014dd30 + offset 775

Previous Frame....: 0

Previous IP.......: 1

Frame size........: 15 (1 arguments, 14 local variables)

Argument[0].......: d80d74

Local[1]..........: 0

Local[2]..........: 1

Local[3]..........: b4

Local[4]..........: b2

Local[5]..........: 1

Local[6]..........: 0

Local[7]..........: 0

Local[8]..........: 0

Local[9]..........: 0

Local[10]..........: 0

Local[11]..........: 0

Local[12]..........: 0

Local[13]..........: d80d24

Local[14]..........: 0



VM status:

Instruction pointer.: df7756 (offset within invoking method: 398)

Next instruction....: 0xbb

Frame pointer.......: d80bb4

Local pointer.......: d80b9c

Stack size..........: 256; sp: d80bcc; ranges: d80a44-d80c44;df5e7c-df607c;

Contents of the current stack frame:

d80b9c: d83ae4 (lp)

d80ba0: d806e4

d80ba4: dee9f4

d80ba8: dee9e0

d80bac: dee2b4

d80bb0: d80b98

d80bb4: d80b84 (fp)

d80bb8: 10151c4a

d80bbc: d80b98

d80bc0: df8374

d80bc4: d80a3c

d80bc8: 0 (end of frame)

d80bcc: d83ae4 (sp)

Execution stack contains 396 items:

d80d74

0

1

b4

b2

1

0

0

0

0

0

0

0

d80d24

0

0

1

de9e3c

100e9e14

d80a3c

0

d80d90

0

1

b4

b2

0

d80d84

d80d30

d80a80

1014e037

d80a94

100ea50c

d80a3c

0

d811f8

0

1

b4

b2

0

d80ab8

1014e745

d80acc

100e90f0

d80a3c

0

d83bb8

0

1

b4

b2

0

d80ae8

1014cdd0

d80afc

100d5a44

d80a3c

0

d83bd0

0

1

b4

b2

0

d83ae4

d816fc

d80a3c

d80b18

1012c54b

d80b2c

100e73dc

d80a3c

0

d83ae4

d806e4

0

d816f0

b2

d80b54

d80b54

1014a6e3

d80b68

100ec7cc

d80a3c

0

d83ae4

d806e4

dee9f4

dee9e0

dee2b4

d80b98

d80b84

10151c4a

d80b98

df8374

d80a3c

0

d83ae4



Execution completed.

641154 bytecodes executed

120 thread switches

492 classes in the system (including system classes)

3892 dynamic objects allocated (144072 bytes)

8 garbage collections (89188 bytes collected)

ALERT: Invalid heap pointer found

Execution completed.

641154 bytecodes executed

120 thread switches

492 classes in the system (including system classes)

3892 dynamic objects allocated (144072 bytes)

8 garbage collections (89188 bytes collected)

java.lang.IllegalArgumentException: No line matching interface Clip supporting format PCM_SIGNED, 11025.0 Hz, 16 bit, mono, little-endian, audio data, and buffers of 13680 to 13680 bytes is supported.

java.lang.IllegalArgumentException: No line matching interface Clip supporting format PCM_SIGNED, 11025.0 Hz, 16 bit, mono, little-endian, audio data, and buffers of 8514 to 8514 bytes is supported.

java.lang.IllegalArgumentException: No line matching interface Clip supporting format PCM_SIGNED, 11025.0 Hz, 16 bit, mono, little-endian, audio data, and buffers of 16760 to 16760 bytes is supported.

java.lang.IllegalArgumentException: No line matching interface Clip supporting format PCM_SIGNED, 11025.0 Hz, 16 bit, mono, little-endian, audio data, and buffers of 32760 to 32760 bytes is supported.

java.lang.IllegalArgumentException: No line matching interface Clip supporting format PCM_SIGNED, 11025.0 Hz, 16 bit, mono, little-endian, audio data, and buffers of 31654 to 31654 bytes is supported

...全文
362 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
x0y1z2 2004-11-18
  • 打赏
  • 举报
回复
会不会文件路径有中文阿
efei 2004-11-18
  • 打赏
  • 举报
回复
把System.out去掉就可以了,呵呵
王旺旺旺 2004-11-15
  • 打赏
  • 举报
回复
大哥,你的system.out用的太多了吧。

paint()没执行一次,就要输出一次,
太多了。

完全失去了它作为调试信息显示的意义。
zcwhgj 2004-11-15
  • 打赏
  • 举报
回复
把这一些:System.out.println(e+"Animate")注释掉.
还有一种办法就是换一个模拟器试一试,比如用索爱的,就可以用很多这种语句.
batfree 2004-11-12
  • 打赏
  • 举报
回复
我也遇到过,有时候是因为内存超出限制,结果超出了JVM的限制,出现这样的事情。还有一次是我使用的是JDK1.5+WTK2.0结果就出现这样的问题了。
ivsking 2004-11-10
  • 打赏
  • 举报
回复
会不会是模拟器的问题呀?
goodnow 2004-11-04
  • 打赏
  • 举报
回复

我遇到过类似的问题,是程序占用内存空间太多。
我当时解决方法是
把System.out.println去掉一些,或者放在循环外。
delphiseabird 2004-11-04
  • 打赏
  • 举报
回复
一句一句的注释掉 看看是哪句出的错
JavaAndJava 2004-10-29
  • 打赏
  • 举报
回复
估计是临时变量过大,超了kvm的栈空间
cnesky 2004-10-28
  • 打赏
  • 举报
回复
用断点调试,看看问题在哪里啊
ivsking 2004-10-28
  • 打赏
  • 举报
回复
对应的AnimatedImage类:

import java.util.*;
import javax.microedition.lcdui.*;
import java.util.Timer;
import java.util.TimerTask;

public class AnimatedImage {
Gamescreen canvas;
private final Timer timer = new Timer();
Image plane;
Vector position;
int count;


public AnimatedImage(Gamescreen can,Image plane,Vector position) {
System.out.println("AnimatedImage construct");
this.canvas=can;
this.plane=plane;
this.position=position;
count=0;
}

public void start(Graphics g) {
timer.schedule(new task(g),0,200);
canvas.repaint();
}

protected class task extends TimerTask
{
Graphics g;
public task(Graphics g)
{
this.g=g;
System.out.println("task construct");
}
public void run()
{
draw(g);

if(count>position.size())
{timer.cancel();
canvas.move=false;//设置Gamescreen的控制变量
System.out.println("timer cancel");
}
}
private void draw(Graphics g)
{
System.out.println("chess moving");
g.drawImage(plane, ((Integer)position.elementAt(count)).byteValue(),((Integer)position.elementAt(count+1)).byteValue(),Graphics.HCENTER | Graphics.VCENTER);
System.out.println("chemoving:"+((Integer)position.elementAt(count+1)).byteValue());
System.out.println("chemoving:"+((Integer)position.elementAt(count)).byteValue());
System.out.println(plane.getHeight());
System.out.println("chess movingdrawImag");

count=count+2;

}
}



}

13,100

社区成员

发帖
与我相关
我的任务
社区描述
Java J2ME
社区管理员
  • J2ME社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧