java 静态类 加载_java静态类加载的问题

出现这样的错误如何解决javax.imageio.IIOException:Can'treadinputfile!atjavax.imageio.ImageIO.read(UnknownSource)atorg.liky.mario.StaticValue.init(StaticValue.java:30)atorg...

出现这样的错误如何解决javax.imageio.IIOException: Can't read input file!at javax.imageio.ImageIO.read(Unknown Source)at org.liky.mario.StaticValue.init(StaticValue.java:30)at org.liky.mario.MyFrame.(MyFrame.java:32)at org.liky.mario.MyFrame.main(MyFrame.java:21)javax.imageio.IIOException: Can't read input file!at javax.imageio.ImageIO.read(Unknown Source)at org.liky.mario.StaticValue.init(StaticValue.java:73)at org.liky.mario.MyFrame.(MyFrame.java:32)at org.liky.mario.MyFrame.main(MyFrame.java:21)javax.imageio.IIOException: Can't read input file!at javax.imageio.ImageIO.read(Unknown Source)at org.liky.mario.StaticValue.init(StaticValue.java:73)at org.liky.mario.MyFrame.(MyFrame.java:32)at org.liky.mario.MyFrame.main(MyFrame.java:21)Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 9, Size: 0at java.util.ArrayList.RangeCheck(Unknown Source)at java.util.ArrayList.get(Unknown Source)at org.liky.mario.Obstruction.setImage(Obstruction.java:33)at org.liky.mario.Obstruction.(Obstruction.java:20)at org.liky.mario.BackGround.(BackGround.java:33)at org.liky.mario.MyFrame.(MyFrame.java:35)at org.liky.mario.MyFrame.main(MyFrame.java:21)  我用的是MyEclipse6.5public static String imagePath=System.getenv("user.dir")+"/bin/";//将全部的图片初始化public static void init(){  //将所有主角的图片保存到静态的属性中  for (int i=1;i<=2;i++){   try {    allSheepImage.add(ImageIO.read(new File(imagePath+i+".gif")));   } catch (IOException e) {    // TODO Auto-generated catch block    e.printStackTrace();图片保存在C:\Documents and Settings\WWW-5D09ADF20DA\workspace\Sheep Fighter\bin请问是哪里出错了

展开

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值