首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

java.io.IOException: invalid header field,DOS下 jar 时发生错误

2014-01-26 
getMIDletProperties.javaimport javax.microedition.midlet.*import javax.microedition.lcdui.*public

getMIDletProperties.java
 
  import javax.microedition.midlet.*;
  import javax.microedition.lcdui.*;
  public class getMIDletProperties extends MIDlet
  {
  private Display aDisplay;
  private Form aForm;
  private TextField aTextField;
  private String proString="";
  public getMIDletProperties()
  {
  proString=proString+"Vendor:"+getAppProperty("MIDlet-Vendor")+"\n";
  proString=proString+"Description:"+getAppProperty("MIDlet-Description")+"\n";
  proString=proString+"CreateDate:"+getAppProperty("Create Date")+"\n";
  proString=proString+"MIDlet-Data-Size:"+getAppProperty("MIDlet-Data-Size")+"\n";
  aForm=new Form("MIDlet Properties");
  aTextField=new TextField("properties:",proString,5000,TextField.ANY);
  aForm.append(aTextField);
  }
  public void startApp() throws MIDletStateChangeException
  {
  aDisplay=Display.getDisplay(this);
  aDisplay.setCurrent(aForm);
  }
  public void pauseApp()
  {
  }
  public void destroyApp(boolean unconditional)
  {
  }
  }
 
 
  MANIFEST.MF
 
  MIDlet-Name:Show_Properties_MIDlet
  MIDlet-Version:1.0.0
  MIDlet-Vendor:AlexWen
  MIDlet-1:ShowProps,/suite.png,getMIDletProperties
  MicroEdition-Profile:MIDP-2.0
  MIDlet-Description:List The MIDlet Properties
  MIDlet-Data-Size:1500
 
  DOS下运行
  D:\java\getpros>javac -g:none -bootclasspath F:\Java\midp2.0fcs\classes getMIDletProperties.java
 
  D:\java\getpros>preverify -classpath F:\Java\midp2.0fcs\classes getMIDletProperties
 
  D:\java\getpros>jar -cvfm getPros.jar MANIFEST.MF getMIDletProperties.class suite.png   
  java.io.IOException: invalid header field   
                  at java.util.jar.Attributes.read(Attributes.java:387)
  at java.util.jar.Manifest.read(Manifest.java:167)
  at java.util.jar.Manifest.<init>(Manifest.java:52)
  at sun.tools.jar.Main.run(Main.java:124)
  at sun.tools.jar.Main.main(Main.java:904)
 

------解决方法--------------------------------------------------------
用wtk打包 有没有问题哦?
------解决方法--------------------------------------------------------
使用Ktoolbar:把类文件放src,图片放res,jad文件放bin,manifest.mf放bin
  就OK
  你是不是在用J2ME无线通信实用案例教程上的例子嘛?   

 

        

热点排行