String pciName=prop.getProperty("pic"+(x+1));
//用class去加载这个pic子类
Class clazz=Class.forName(pciName);
IPCI p=(IPCI)clazz.newInstance();
mb.usePCI(p);
pci.properties文件的内容
pci1=y13.m1.d2b.SoundCard
pci2=y13.m1.d2b.NetCard
为什么总是报异常呢?
Exception in thread "main" java.lang.NullPointerException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at y13.m1.d2b.ReflectTest.main(ReflectTest.java:33)
|