Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » 移动互联网  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 (HELP)各位帮忙看个错误,关于JAVA.IO的.谢谢!
hts626





发贴: 7
积分: 0
于 2007-03-11 23:04 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
请问,这是怎么回事啊?

我在命令行里运行出一个类似含义的错误:

C:\j2me\projects\hello>midp -classpath . -Xdescriptor abc.jad
java.io.UTFDataFormatException: invalid first byte 11111111

我做了1个包之后
在命令提示符下输入C:\j2me\projects\hello>midp -classpath . -Xdescriptor abc.jad,
却返回了这个错误,

但我把包里的CLASS分别测试时,可正常运行.有人说是注释有问题,我把注释去了,可问题依旧.所以想到是不是CLDC版本闹的,要不是SDK?我用的是1.5

请问,怎么回事呢?

我自己分析觉的是编码有问题,好象J2ME有2种编码吧?GBK和UTF-8,这些书上也是只字未提,请老师帮我看看这是怎么回事吧~



作者 Re:(HELP)各位帮忙看个错误,关于JAVA.IO的.谢谢! [Re:hts626]
hts626





发贴: 7
积分: 0
于 2007-03-11 23:08 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
运行单个MIDlet时没问题,只要是打包文件,运行都有问题,我是不是打包命令不对阿?

我用的是:JAR -CVF abc.jar a.class b.class c.class
完了之后,我发现打包之后的MANIFEST.MF里只有2个条目,版本和作者。其他的全没有,也不知道为什么 ?

请各位帮分析一下,我分析好几天了,没出结果。。。。。。



作者 Re:(HELP)各位帮忙看个错误,关于JAVA.IO的.谢谢! [Re:hts626]
JiafanZhou



版主


发贴: 736
积分: 61
于 2007-03-12 18:12 user profilesend a private message to usersend email to JiafanZhousearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
有人说是注释有问题,我把注释去了
whoever told you that is an idiot.

Your jar looks fine to me. Check your source code, see which line throw out this UTFDataFormatException, run the debugger, run your program. If you still cannot figure it out, copy paste the source code here. Let others have a look at it.

Cheers,
Jiafan



When I was a kid I used to pray every night for a new bike. Then I realized that The Lord doesn't work that way, so I stole one and asked him to forgive me.
作者 Re:(HELP)各位帮忙看个错误,关于JAVA.IO的.谢谢! [Re:HenryShanley]
hts626





发贴: 7
积分: 0
于 2007-03-13 00:53 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
thank you


作者 Re:(HELP)各位帮忙看个错误,关于JAVA.IO的.谢谢! [Re:hts626]
hts626





发贴: 7
积分: 0
于 2007-03-13 00:59 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
This is the first:

import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.*;

public class Hello extends javax.microedition.midlet.MIDlet
implements CommandListener
{
protected Form form;
protected Command quit;

public Hello()
{

form = new Form("My Midlet");
form.append("Hello, Micro World!");

form.setCommandListener(this);
quit = new Command("Quit", Command.SCREEN, 1);
form.addCommand(quit);
}

protected void startApp() throws MIDletStateChangeException
{

Display.getDisplay(this).setCurrent(form);
}


protected void pauseApp()
{
}


protected void destroyApp(boolean unconditional)
throws MIDletStateChangeException
{
}

public void commandAction(Command command, Displayable displayable)
{

try
{
if (command == quit)
{
destroyApp(true);


notifyDestroyed();
}
}

catch (MIDletStateChangeException me)
{ }
}
}

and second:

import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.*;

public class Hello2 extends Hello
{

public Hello2()
{

form = new Form("My 2nd Midlet");
form.append("Hello, to another Micro World!");

form.setCommandListener(this);
quit = new Command("Quit", Command.SCREEN, 1);
form.addCommand(quit);
}
}



作者 Re:(HELP)各位帮忙看个错误,关于JAVA.IO的.谢谢! [Re:hts626]
hts626





发贴: 7
积分: 0
于 2007-03-13 01:01 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
When I used WTK,it's OK.but When DOS,like this wrong was so big!


作者 Re:(HELP)各位帮忙看个错误,关于JAVA.IO的.谢谢! [Re:hts626]
cxp108





发贴: 363
积分: 12
于 2007-03-13 10:29 user profilesend a private message to usersend email to cxp108search all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
LZ是否检查过你的jad和MANIFEST.MF文件是否是UTF-8编码?

你这两个文件用什么写的?note pad?还是DOS下的edit?



作者 Re:(HELP)各位帮忙看个错误,关于JAVA.IO的.谢谢! [Re:cxp108]
hts626





发贴: 7
积分: 0
于 2007-03-13 13:58 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
note.pad
我疑惑是不是一部分是GBK,一部分是UTF-8,可怎么会出这样事情呢?
预校验完了的CLASS单个可以正常运行,说明不应该有问题啊?



作者 Re:(HELP)各位帮忙看个错误,关于JAVA.IO的.谢谢! [Re:hts626]
cxp108





发贴: 363
积分: 12
于 2007-03-13 23:03 user profilesend a private message to usersend email to cxp108search all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
找个工具把那两个文件编码专成UTF-8看看


作者 Re:(HELP)各位帮忙看个错误,关于JAVA.IO的.谢谢! [Re:hts626]
hts626





发贴: 7
积分: 0
于 2007-03-16 20:31 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
问一下,您作jar生成的jar文件中的manifest.mf文件内容是就2行内容吗?
为什么我利用命令行生成的mf文件里面只有2行内容啊?好奇怪啊?
怎么也搞不清楚.目前为止,我只能利用wtk了,其实不太喜欢那东西,但也没办法额.




flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923