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 { ...@@ -163,27 +163,26 @@ public class Launcher {
private synchronized void startApplication() { private synchronized void startApplication() {
if (messengerd == null) { if (messengerd == null) {
File binDir = null;
File libDir = null; File libDir = null;
File homeDir = null;
File exe = null; File exe = null;
try { 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 // so we'll do a search for messengerd rather than relying on it being where
// we think it will be... // 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())) { if (libDir.exists()) {
// Windows messengerd = Runtime.getRuntime().exec(new String[]{"java", "-jar", new File(libDir, "startup.jar").toString()});
exe = new File(parentDir, "messenger.exe");
if (exe.exists()) {
messengerd = Runtime.getRuntime().exec(new String[]{exe.toString()});
} }
else { else {
// MacOS X // MacOS X
exe = new File(parentDir, "messenger.app"); exe = new File(homeDir, "messenger.app");
if (exe.exists()) { if (exe.exists()) {
messengerd = Runtime.getRuntime().exec(new String[]{ messengerd = Runtime.getRuntime().exec(new String[]{
...@@ -192,7 +191,7 @@ public class Launcher { ...@@ -192,7 +191,7 @@ public class Launcher {
} }
else { else {
// Unix // Unix
exe = new File(parentDir, "messenger"); exe = new File(homeDir, "messenger");
if (exe.exists()) { if (exe.exists()) {
messengerd = Runtime.getRuntime().exec(new String[]{exe.toString()}); messengerd = Runtime.getRuntime().exec(new String[]{exe.toString()});
...@@ -203,11 +202,10 @@ public class Launcher { ...@@ -203,11 +202,10 @@ public class Launcher {
} }
} }
} }
}
catch (Exception e) { catch (Exception e) {
// Try one more time using the jar and hope java is on the path // Try one more time using the jar and hope java is on the path
try { try {
if (libDir != null) { if (binDir != null) {
messengerd = Runtime.getRuntime().exec(new String[]{ messengerd = Runtime.getRuntime().exec(new String[]{
"java", "-jar", new File(libDir, "startup.jar").toString() "java", "-jar", new File(libDir, "startup.jar").toString()
}); });
...@@ -250,7 +248,7 @@ public class Launcher { ...@@ -250,7 +248,7 @@ public class Launcher {
BrowserLauncher.openURL("http://127.0.0.1:" + port + "/index.html"); BrowserLauncher.openURL("http://127.0.0.1:" + port + "/index.html");
} }
catch (Exception e) { 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