看看jar 命令的使用,讲的很清楚,如何打包讲的很清楚:)

解决方案 »

  1.   

    ClassLoader instance.getResource("....")
    or getResourceAsStream("...") i believe. they will look into the jar file(s).ClassLoader could be Thread.currThread().getContextClassLoader(). or XXXClass.class.getClassLoader();
      

  2.   

    E:\application\j2sdk1.4.0\bin\jar cf helloworld.jar SimpleExample/HelloWorld.class
    你可以照样子把gif,jpg文件加入jar中
      

  3.   

    谢谢大家,是我没说清楚~
    打包我会,但我不知道怎样从jar中读取文件数据.
      

  4.   

    这样就可以访问你的图片:
    “/test1/test2/aaa.gif”是你的图片在包中的位置。ImageIcon ii=new ImageIcon(getClass().getResource("/test1/test2/aaa.gif"));
      

  5.   

    谢谢大家~~
    那么如何读取比如txt文本文件呢?
      

  6.   

    http://expert.csdn.net/Expert/topic/1927/1927076.xml?temp=.221966
      

  7.   

    http://expert.csdn.net/Expert/topic/1916/1916904.xml?temp=.8560755
      

  8.   

    我好笨啊我~~~搞定~~~哈哈哈
    用 getClass().getResource() 就成了~
    谢了啊,弟兄们!