Commit 0e4e613d authored by Derek DeMoro's avatar Derek DeMoro Committed by derek

Launcher now works with startup.jar


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@252 b35dd754-fafc-0310-a699-88a17e54d16e
parent cea4de90
......@@ -163,27 +163,26 @@ public class Launcher {
private synchronized void startApplication() {
if (messengerd == null) {
File binDir = null;
File libDir = null;
File homeDir = null;
File exe = null;
try {
// Aliases keep their cwd rather than the aliased libDir's cwd on MacOS X
// Aliases keep their cwd rather than the aliased binDir's cwd on MacOS X
// so we'll do a search for messengerd rather than relying on it being where
// we think it will be...
libDir = new File("").getAbsoluteFile();
binDir = new File("").getAbsoluteFile();
libDir = new File("../lib").getAbsoluteFile();
homeDir = binDir.getParentFile();
File parentDir = libDir.getParentFile();
if ("lib".equals(libDir.getName())) {
// Windows
exe = new File(parentDir, "messenger.exe");
if (exe.exists()) {
messengerd = Runtime.getRuntime().exec(new String[]{exe.toString()});
if (libDir.exists()) {
messengerd = Runtime.getRuntime().exec(new String[]{"java", "-jar", new File(libDir, "startup.jar").toString()});
}
else {
// MacOS X
exe = new File(parentDir, "messenger.app");
exe = new File(homeDir, "messenger.app");
if (exe.exists()) {
messengerd = Runtime.getRuntime().exec(new String[]{
......@@ -192,7 +191,7 @@ public class Launcher {
}
else {
// Unix
exe = new File(parentDir, "messenger");
exe = new File(homeDir, "messenger");
if (exe.exists()) {
messengerd = Runtime.getRuntime().exec(new String[]{exe.toString()});
......@@ -203,11 +202,10 @@ public class Launcher {
}
}
}
}
catch (Exception e) {
// Try one more time using the jar and hope java is on the path
try {
if (libDir != null) {
if (binDir != null) {
messengerd = Runtime.getRuntime().exec(new String[]{
"java", "-jar", new File(libDir, "startup.jar").toString()
});
......@@ -250,7 +248,7 @@ public class Launcher {
BrowserLauncher.openURL("http://127.0.0.1:" + port + "/index.html");
}
catch (Exception e) {
e.printStackTrace();
JOptionPane.showMessageDialog(new JFrame(), configFile + " " + e.getMessage());
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment