1. src\java ;
2.openfire\src\i18n, OK Classpath ;
3. openfire\src\resources jar Classpath 。
4.openfire org.jivesoftware.openfire.starter.ServerStarter.java, , Openfire , JAR class , class 。 , 。
src/java java project src , org.jivesoftware.openfire.starter ServerStarter.java , ( ServerStarter.java , ClassLoader XMPPServer.class )
package org.jivesoftware.openfire.starter;
import org.jivesoftware.openfire.XMPPServer;
public class StandaloneStarter {
public static void main(String[] args) {
XMPPServer server = new XMPPServer();
}
}
, 。
5.
( Openfire Home ), :
Could not locate home
java.io.FileNotFoundException......
ERROR 12114 [Jive-ERR] ():
java.io.FileNotFoundException: XML properties file does not exist: openfire.xml........
XMPPServer locateOpenfire , openfireHome 。
1 :
String jiveConfigName = "conf" + File.separator + "openfire.xml";
// First, try to load it openfireHome as a system property.
if (openfireHome == null) {
String homeProperty = System.getProperty("openfireHome");
try {
if (homeProperty != null) {
openfireHome = verifyHome(homeProperty, jiveConfigName);
}
}
catch (FileNotFoundException fe) {
// Ignore.
}
}
Openfire Home openfire.xml
Openfire Home:
// If we still don't have home, let's assume this is standalone
// and just look for home in a standard sub-dir location and verify
// by looking for the config file
if (openfireHome == null) {
try {
// , ".."
openfireHome=verifyHome("C:\\Program Files\\Openfire", jiveConfigName).getCanonicalFile();
}
catch (FileNotFoundException fe) {
// Ignore.
}
catch (IOException ie) {
// Ignore.
}
}
, openfire , 。
6. src/web/WEB-INF/classes/openfire_init.xml eclipse , src/web/WEB-INF/classes eclipse , openfire_init.xml copy $openfire_home/classses , openfire_init.xml openfireHome $openfire_home
org.jivesoftware.openfire.starter.ServerStarter field,
private static final String DEFAULT_LIB_DIR = "../lib";
private static final String DEFAULT_ADMIN_LIB_DIR = "../plugins/admin/webapp/WEB-INF/lib";
:
private static final String DIR_PREFIX = "$openfire_home";
// to be your own openfire_home
private static final String DEFAULT_LIB_DIR = DIR_PREFIX + "lib";
private static final String DEFAULT_ADMIN_LIB_DIR = DIR_PREFIX + "plugins/admin/webapp/WEB-INF/lib";
?????