我用jar打包一个能显示图像的类,命令如下:jar -cmfv MANIFEST.txt PicApp3.jar PicApp3.class fl.GIFPicApp3中包含main函数,如果fl.GIF和PicApp3.jar在同一个目录中的时候运行PicApp3.jar能显示图像,但是删除了fl.GIF程序就不能显示了,还能运行。我就怀疑了,难道打包了之后还要外带图像?包里面明明有图像的。Manifest-Version: 1.0
Created-By: 1.5.0_11 (Sun Microsystems Inc.)
Main-Class: PicApp3请告诉我如何能让程序利用它自己包里面的图像。
谢谢
Created-By: 1.5.0_11 (Sun Microsystems Inc.)
Main-Class: PicApp3请告诉我如何能让程序利用它自己包里面的图像。
谢谢
icoLogo=new ImageIcon("fl.GIF");
jlblLogo=new JLabel(icoLogo);
new ImageIcon(this.getClass().getResource("imagefilepath"));orSwingResourManager.getIcon(main.Class,"imagefilepath");