我的 java 程序正在为某些 AWT 类 抛出 java.lang.ClassNotFoundException 我该怎么办?
My java program is throwing java.lang.ClassNotFoundException for some AWT classes what do I do?
当我 运行 Java 调试器时,我发现这个 "java.lang.ClassNotFoundException: sun/awt/resources/spi/awtProvider" 和 "java.io.FileNotFoundException: C:\Program Files\AdoptOpenJDK\jdk-11.0.6.10-hotspot\conf\accessibility.properties(系统找不到指定的文件)”我想我知道为什么,我的数据存储 运行 低所以我将我的程序移动到不同的驱动器,是那为什么它找不到 java API 类?我该如何解决这个问题?
您不需要修复此问题。
sun.awt.resources.spi.awtProvider
是一个 class 名称,自动生成为可能的资源包提供程序。如果未找到 class,它将被忽略。
try {
resources = ResourceBundle.getBundle("sun.awt.resources.awt");
} catch (MissingResourceException e) {
// No resource file; defaults will be used.
}
accessibility.properties
是一个可选文件,可用于配置辅助技术。如果找不到此文件,则不会发生任何变化。
try {
File propsFile = new File(
System.getProperty("java.home") + sep + "conf" +
sep + "accessibility.properties");
FileInputStream in =
new FileInputStream(propsFile);
// Inputstream has been buffered in Properties class
properties.load(in);
in.close();
} catch (Exception e) {
// System-wide accessibility properties file does
// not exist;
}
当我 运行 Java 调试器时,我发现这个 "java.lang.ClassNotFoundException: sun/awt/resources/spi/awtProvider" 和 "java.io.FileNotFoundException: C:\Program Files\AdoptOpenJDK\jdk-11.0.6.10-hotspot\conf\accessibility.properties(系统找不到指定的文件)”我想我知道为什么,我的数据存储 运行 低所以我将我的程序移动到不同的驱动器,是那为什么它找不到 java API 类?我该如何解决这个问题?
您不需要修复此问题。
sun.awt.resources.spi.awtProvider
是一个 class 名称,自动生成为可能的资源包提供程序。如果未找到 class,它将被忽略。
try {
resources = ResourceBundle.getBundle("sun.awt.resources.awt");
} catch (MissingResourceException e) {
// No resource file; defaults will be used.
}
accessibility.properties
是一个可选文件,可用于配置辅助技术。如果找不到此文件,则不会发生任何变化。
try {
File propsFile = new File(
System.getProperty("java.home") + sep + "conf" +
sep + "accessibility.properties");
FileInputStream in =
new FileInputStream(propsFile);
// Inputstream has been buffered in Properties class
properties.load(in);
in.close();
} catch (Exception e) {
// System-wide accessibility properties file does
// not exist;
}