在目前發行版本中,增加到 domain.xml (應用程式伺服器配置檔案) 的 classpath-prefix、server-classpath 和 classpath-suffix 屬性的 JAR 和目錄項目在 JVM 系統類別路徑中可用。附屬於此運作方式的應用程式可能會使用 java.lang.ClassLoader 類別中的以下方法,存取 JVM 系統類別路徑中的類別或其他資源:
getSystemClassLoader()
getSystemResource()
getSystemResourceAsStream()
getSystemResources
在下一個重大發行版本中,增加到 classpath-prefix、server-classpath 和 classpath-suffix 的 JAR 和目錄項目在 JVM 系統類別路徑中將不再可用。如果應用程式使用上述方法之一,Sun 強烈建議您使用不會假設資源在系統類別路徑中可用的等效方法。不附屬於 JVM 系統類別路徑的等效方法在 java.lang.ClassLoader 中可用,並應在可能時使用,例如:
java.net.URL url = ClassLoader.getSystemResource ("com/acme/tools/tools.properties");
java.net.URL url = this.getClass().getClassLoader().getResource ("com/acme/tools/tools.properties");
如果無法變更代碼,您可以選擇使用將在下一個發行版本中增加的新配置選項來設定 JVM 系統類別路徑。