我还有一个问题。当我从NetBeans IDE运行项目时,一切都很好。但是当我试图构建项目时,我有例外:
Compiling 2 source files to D:JAVAProjectsstreamerbuildclasses
An exception has occurred in the compiler (1.7.0-ea). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at java.lang.String.startsWith(String.java:1433)
at java.lang.String.startsWith(String.java:1462)
at com.sun.tools.javac.file.SymbolArchive.addZipEntry(SymbolArchive.java:49)
at com.sun.tools.javac.file.ZipArchive.<init>(ZipArchive.java:63)
at com.sun.tools.javac.file.SymbolArchive.<init>(SymbolArchive.java:41)
............
D:JAVAProjectsstreamernbprojectbuild-impl.xml:603: The following error occurred while executing this line:
D:JAVAProjectsstreamernbprojectbuild-impl.xml:245: Compile failed; see the compiler error output for details.
我没有使用字符串。startsWith方法,但我使用String。indexOf在一个地方:
int lastIndex = nodeName.indexOf("date",0);
if (lastIndex != -1 || nodeName.equals("birthday")) {
txt_val = getHash(txt_val,Boolean.TRUE);
} else {
txt_val = getHash(txt_val,Boolean.FALSE);
}
nodeName不为空。我不明白哪里是错误:(
你是有意使用Java 7吗?试试Java 6吧——它应该会更稳定。更改NetBeans项目中的JRE
编译器中出现异常。为什么使用java 1.7?