我写了一个类,用来获取磁盘空间,在命令行下按如下方式运行,结果居然不一样,谁能解释下
E:\WEB-INF\classes>java -cp .;E:\WEB-INF\lib\JConfig.zip com.test.DiskTest
JConfig EVALUATION VERSION 2.2.0
Copyright (c) 1997-2002 Samizdat Productions. All Rights Reserved.
Visit us at www.tolstoy.com
Exception in thread "main" java.lang.NullPointerException
at com.video.x86.test.DiskTest.main(DiskTest.java:41)
E:\WEB-INF\classes>D:\jdk1.6\bin\java -cp .;E:\WEB-INF\lib\JConfig.zip com.test.DiskTest
JConfig EVALUATION VERSION 2.2.0
Copyright (c) 1997-2002 Samizdat Productions. All Rights Reserved.
Visit us at www.tolstoy.com
diskObj==================com.jconfig.win.DiskFileMSVM@e89b94
diskObj==================6362234470444263165952
E:\WEB-INF\classes>java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
E:\WEB-INF\classes>D:\jdk1.6\bin\java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
------解决方案--------------------
用的jdk不是这一个吧