【发布时间】:2018-10-18 17:39:24
【问题描述】:
在我尝试用它创建一个 jar 之前,我的项目运行良好... 从这个类/TS_Generic_Engine/auto_engine_class/Resources.java 我正在解析这个 xml 文件:/TS_Generic_Engine/resources/values/strings.xml
String stringFilename = "resources/values" + langId + "/strings.xml";
InputStream fXmlFileStream = getClass().getResourceAsStream("../" + stringFilename);
if ( fXmlFileStream == null ) {
if (language == RESOURCE_LANGUAGE.LANG_DEFAULT) {
System.out.println("WARNING: No default strings resource found. Expected: " + stringFilename);
}
return null;
}
工作正常,但是当我将项目导出到 jar 中时,我的大多数 java 文件都会出现“导出时出现编译警告”..
当我尝试运行这个 jar 时,有这样的输出:
WARNING: No default strings resource found. Expected: resources/values/strings.xml
WARNING: Resources have not been initialized.
WARNING: Resources have not been initialized.
WARNING: Resources have not been initialized.
Exception occurred during playback of script [UserControlScript] [CRFCN0019E: RationalTestScriptException on line 56 of script UserControlScript - java.lang.NullPointerException: null.].
如果我解压缩 jar,文件的位置是 MyJar.zip/resources/values/string.xml 和 MyJar.zip/auto_engine_class/Resources.java。
【问题讨论】: