check for server property

This commit is contained in:
BetaSteward 2010-12-10 10:49:56 -05:00
parent 681a030b8e
commit 7507a97712

View file

@ -85,7 +85,12 @@ public class Main {
}
}
Copier.setLoader(classLoader);
String ip = config.getServerAddress();
setServerAddress(config.getServerAddress());
server = new ServerImpl(config.getPort(), config.getServerName(), testMode);
}
private static void setServerAddress(String ip) {
try {
if (ip.equals("localhost")) {
ip = InetAddress.getLocalHost().getHostAddress();
@ -93,12 +98,14 @@ public class Main {
} catch (UnknownHostException ex) {
logger.log(Level.WARNING, "Could not get server address: ", ex);
}
String ipParam = System.getProperty("server");
if (ipParam != null) {
ip = ipParam;
}
System.setProperty("java.rmi.server.hostname", ip);
logger.info("MAGE server - using address " + ip);
server = new ServerImpl(config.getPort(), config.getServerName(), testMode);
}
}
private static Class<?> loadPlugin(Plugin plugin) {
try {
classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL());