Commit 92a7f092 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Fixed launching application under Windows 2003 and 2000.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1248 b35dd754-fafc-0310-a699-88a17e54d16e
parent 731107bb
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<install4j version="3.1.2"> <install4j version="3.1.4">
<directoryPresets config="" /> <directoryPresets config="" />
<application name="%APP_NAME%" distributionSourceDir="" applicationId="6886-9911-0474-3571" mediaDir="../../target/release" mediaFilePattern="%FILE_PREFIX%_%VERSION_MAJOR%_%VERSION_MINOR%_%VERSION_REVISION%" compression="9" shortName="%APP_SHORT_NAME%" publisher="%PUBLISHER%" publisherWeb="%PUBLISHER_URL%" version="%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%" allPathsRelative="true" backupOnSave="false" autoSave="true" javaMinVersion="1.5" javaMaxVersion="" allowBetaVM="false"> <application name="%APP_NAME%" distributionSourceDir="" applicationId="6886-9911-0474-3571" mediaDir="../../target/release" mediaFilePattern="%FILE_PREFIX%_%VERSION_MAJOR%_%VERSION_MINOR%_%VERSION_REVISION%" compression="9" shortName="%APP_SHORT_NAME%" publisher="%PUBLISHER%" publisherWeb="%PUBLISHER_URL%" version="%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%" allPathsRelative="true" backupOnSave="false" autoSave="true" macSignature="????" javaMinVersion="1.5" javaMaxVersion="" allowBetaVM="false">
<searchSequence> <searchSequence>
<registry /> <registry />
<envVar name="JAVA_HOME" /> <envVar name="JAVA_HOME" />
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<versionLine x="20" y="40" text="version %VERSION%" font="Arial" fontSize="8" fontColor="0,0,0" fontWeight="500" /> <versionLine x="20" y="40" text="version %VERSION%" font="Arial" fontSize="8" fontColor="0,0,0" fontWeight="500" />
</text> </text>
</splashScreen> </splashScreen>
<java mainClass="org.jivesoftware.messenger.launcher.Launcher" vmParameters="" arguments="" allowVMPassthroughParameters="true" minVersion="" maxVersion="" preferredVM="server" allowBetaVM="false"> <java mainClass="org.jivesoftware.messenger.launcher.Launcher" vmParameters="&quot;-Dapp.home=%INSTALL4J_EXEDIR%&quot;" arguments="" allowVMPassthroughParameters="true" minVersion="" maxVersion="" preferredVM="server" allowBetaVM="false">
<searchSequence> <searchSequence>
<registry /> <registry />
<envVar name="JAVA_HOME" /> <envVar name="JAVA_HOME" />
......
...@@ -33,8 +33,10 @@ import java.io.FileNotFoundException; ...@@ -33,8 +33,10 @@ import java.io.FileNotFoundException;
*/ */
public class Launcher { public class Launcher {
private String appName;
private Process messengerd; private Process messengerd;
private String configFile = JiveGlobals.getHomeDirectory() + File.separator + "conf" + File.separator + "jive-messenger.xml"; private String configFile = JiveGlobals.getHomeDirectory() + File.separator + "conf" +
File.separator + "jive-messenger.xml";
private JPanel toolbar = new JPanel(); private JPanel toolbar = new JPanel();
private ImageIcon offIcon; private ImageIcon offIcon;
...@@ -56,7 +58,13 @@ public class Launcher { ...@@ -56,7 +58,13 @@ public class Launcher {
e.printStackTrace(); e.printStackTrace();
} }
String title = "Jive Messenger"; if (System.getProperty("app.name") != null) {
appName = System.getProperty("app.name");
}
else {
appName = "Jive Messenger";
}
frame = new DroppableFrame() { frame = new DroppableFrame() {
public void fileDropped(File file) { public void fileDropped(File file) {
String fileName = file.getName(); String fileName = file.getName();
...@@ -66,7 +74,7 @@ public class Launcher { ...@@ -66,7 +74,7 @@ public class Launcher {
} }
}; };
frame.setTitle(title); frame.setTitle(appName);
ImageIcon splash = null; ImageIcon splash = null;
JLabel splashLabel = null; JLabel splashLabel = null;
...@@ -112,7 +120,7 @@ public class Launcher { ...@@ -112,7 +120,7 @@ public class Launcher {
mainPanel.add(toolbar, BorderLayout.SOUTH); mainPanel.add(toolbar, BorderLayout.SOUTH);
// create the main menu of the system tray icon // create the main menu of the system tray icon
JPopupMenu menu = new JPopupMenu("Messenger Menu"); JPopupMenu menu = new JPopupMenu(appName + " Menu");
final JMenuItem showMenuItem = new JMenuItem("Hide"); final JMenuItem showMenuItem = new JMenuItem("Hide");
showMenuItem.setActionCommand("Hide/Show"); showMenuItem.setActionCommand("Hide/Show");
...@@ -226,7 +234,7 @@ public class Launcher { ...@@ -226,7 +234,7 @@ public class Launcher {
showMenuItem.addActionListener(actionListener); showMenuItem.addActionListener(actionListener);
// Set the system tray icon with the menu // Set the system tray icon with the menu
trayIcon = new TrayIcon(offIcon, "Jive Messenger", menu); trayIcon = new TrayIcon(offIcon, appName, menu);
trayIcon.setIconAutoSize(true); trayIcon.setIconAutoSize(true);
trayIcon.addActionListener(actionListener); trayIcon.addActionListener(actionListener);
...@@ -267,9 +275,14 @@ public class Launcher { ...@@ -267,9 +275,14 @@ public class Launcher {
private synchronized void startApplication() { private synchronized void startApplication() {
if (messengerd == null) { if (messengerd == null) {
File appDir = new File("").getAbsoluteFile();
// See if the app.dir property is set. If so, use it to find the executable.
if (System.getProperty("app.dir") != null) {
appDir = new File(System.getProperty("app.dir"));
}
try { try {
File windowsExe = new File(new File("").getAbsoluteFile(), "messengerd.exe"); File windowsExe = new File(appDir, "messengerd.exe");
File unixExe = new File(new File("").getAbsoluteFile(), "messengerd"); File unixExe = new File(appDir, "messengerd");
if (windowsExe.exists()) { if (windowsExe.exists()) {
messengerd = Runtime.getRuntime().exec(new String[]{windowsExe.toString()}); messengerd = Runtime.getRuntime().exec(new String[]{windowsExe.toString()});
} }
...@@ -283,7 +296,7 @@ public class Launcher { ...@@ -283,7 +296,7 @@ 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 {
File libDir = new File("../lib").getAbsoluteFile(); File libDir = new File(appDir.getParentFile(), "lib").getAbsoluteFile();
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()
}); });
...@@ -291,7 +304,7 @@ public class Launcher { ...@@ -291,7 +304,7 @@ public class Launcher {
catch (Exception ex) { catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
JOptionPane.showMessageDialog(null, JOptionPane.showMessageDialog(null,
"Launcher could not start,\nJive Messenger", "Launcher could not start,\n" + appName,
"File not found", JOptionPane.ERROR_MESSAGE); "File not found", JOptionPane.ERROR_MESSAGE);
} }
} }
...@@ -369,5 +382,4 @@ public class Launcher { ...@@ -369,5 +382,4 @@ public class Launcher {
dialog.setLocationRelativeTo(frame); dialog.setLocationRelativeTo(frame);
dialog.setVisible(true); dialog.setVisible(true);
} }
} }
\ No newline at end of file
...@@ -726,9 +726,8 @@ public class JiveGlobals { ...@@ -726,9 +726,8 @@ public class JiveGlobals {
msg.append("Critical Error! The home directory could not be loaded, \n"); msg.append("Critical Error! The home directory could not be loaded, \n");
msg.append("which will prevent the application from working correctly.\n\n"); msg.append("which will prevent the application from working correctly.\n\n");
msg.append("You must set home in one of four ways:\n"); msg.append("You must set home in one of four ways:\n");
msg.append(" 1) Set a servlet init parameter named home.\n"); msg.append(" 1) Add a messenger_init.xml file to your classpath, which points \n ");
msg.append(" 2) Add a messenger_init.xml file to your classpath, which points \n "); msg.append(" to home.\n");
msg.append(" to home. Normally, this file will be in WEB-INF/classes.\n");
msg.append(" 3) Set the JNDI value \"java:comp/env/home\" with a String \n"); msg.append(" 3) Set the JNDI value \"java:comp/env/home\" with a String \n");
msg.append(" that points to your home directory. \n"); msg.append(" that points to your home directory. \n");
msg.append(" 4) Set the Java system property \"home\".\n\n"); msg.append(" 4) Set the Java system property \"home\".\n\n");
...@@ -746,9 +745,9 @@ public class JiveGlobals { ...@@ -746,9 +745,9 @@ public class JiveGlobals {
} }
else { else {
if (!mh.canRead() || !mh.canWrite()) { if (!mh.canRead() || !mh.canWrite()) {
Log.error("Error - the user running this Jive application can not read and write to the " Log.error("Error - the user running this application can not read " +
+ "specified jiveHome directory (" + home + "). Please grant the executing user " "and write to the specified home directory (" + home + "). " +
+ "read and write perms."); "Please grant the executing user read and write permissions.");
} }
} }
xmlProperties = new XMLProperties(home + File.separator + "conf" + xmlProperties = new XMLProperties(home + File.separator + "conf" +
...@@ -774,7 +773,7 @@ class InitPropLoader { ...@@ -774,7 +773,7 @@ class InitPropLoader {
String home = null; String home = null;
InputStream in = null; InputStream in = null;
try { try {
in = getClass().getResourceAsStream("/" + JiveGlobals.getConfigName()); in = getClass().getResourceAsStream("/messenger_init.xml");
if (in != null) { if (in != null) {
SAXReader reader = new SAXReader(); SAXReader reader = new SAXReader();
Document doc = reader.read(in); Document doc = reader.read(in);
......
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