git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/branches/activemq-4.0@451583 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian T. Co 2006-09-30 11:54:01 +00:00
parent 766bf50215
commit 039c2310c4

View File

@ -201,22 +201,25 @@ public class Main {
if(activeMQHome==null){
// guess from the location of the jar
URL url = Main.class.getClassLoader().getResource("org/apache/activemq/broker/Main.class");
URL url = Main.class.getClassLoader().getResource("org/apache/activemq/console/Main.class");
if (url != null) {
try {
JarURLConnection jarConnection = (JarURLConnection) url.openConnection();
url = jarConnection.getJarFileURL();
URI baseURI = new URI(url.toString()).resolve("..");
activeMQHome = new File(baseURI).getCanonicalFile();
System.setProperty("activemq.home",activeMQHome.getAbsolutePath());
} catch (Exception ignored) {
}
}
}
if(activeMQHome==null){
activeMQHome = new File(".");
activeMQHome = new File("../.");
System.setProperty("activemq.home",activeMQHome.getAbsolutePath());
}
}
return activeMQHome;
}
}