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"?>
<install4j version="3.1.2">
<install4j version="3.1.4">
<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>
<registry />
<envVar name="JAVA_HOME" />
......@@ -67,7 +67,7 @@
<versionLine x="20" y="40" text="version %VERSION%" font="Arial" fontSize="8" fontColor="0,0,0" fontWeight="500" />
</text>
</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>
<registry />
<envVar name="JAVA_HOME" />
......
......@@ -33,8 +33,10 @@ import java.io.FileNotFoundException;
*/
public class Launcher {
private String appName;
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 ImageIcon offIcon;
......@@ -56,7 +58,13 @@ public class Launcher {
e.printStackTrace();
}
String title = "Jive Messenger";
if (System.getProperty("app.name") != null) {
appName = System.getProperty("app.name");
}
else {
appName = "Jive Messenger";
}
frame = new DroppableFrame() {
public void fileDropped(File file) {
String fileName = file.getName();
......@@ -66,7 +74,7 @@ public class Launcher {
}
};
frame.setTitle(title);
frame.setTitle(appName);
ImageIcon splash = null;
JLabel splashLabel = null;
......@@ -112,7 +120,7 @@ public class Launcher {
mainPanel.add(toolbar, BorderLayout.SOUTH);
// 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");
showMenuItem.setActionCommand("Hide/Show");
......@@ -226,7 +234,7 @@ public class Launcher {
showMenuItem.addActionListener(actionListener);
// 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.addActionListener(actionListener);
......@@ -267,9 +275,14 @@ public class Launcher {
private synchronized void startApplication() {
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 {
File windowsExe = new File(new File("").getAbsoluteFile(), "messengerd.exe");
File unixExe = new File(new File("").getAbsoluteFile(), "messengerd");
File windowsExe = new File(appDir, "messengerd.exe");
File unixExe = new File(appDir, "messengerd");
if (windowsExe.exists()) {
messengerd = Runtime.getRuntime().exec(new String[]{windowsExe.toString()});
}
......@@ -283,7 +296,7 @@ public class Launcher {
catch (Exception e) {
// Try one more time using the jar and hope java is on the path
try {
File libDir = new File("../lib").getAbsoluteFile();
File libDir = new File(appDir.getParentFile(), "lib").getAbsoluteFile();
messengerd = Runtime.getRuntime().exec(new String[]{
"java", "-jar", new File(libDir, "startup.jar").toString()
});
......@@ -291,7 +304,7 @@ public class Launcher {
catch (Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(null,
"Launcher could not start,\nJive Messenger",
"Launcher could not start,\n" + appName,
"File not found", JOptionPane.ERROR_MESSAGE);
}
}
......@@ -369,5 +382,4 @@ public class Launcher {
dialog.setLocationRelativeTo(frame);
dialog.setVisible(true);
}
}
}
\ No newline at end of file
......@@ -726,9 +726,8 @@ public class JiveGlobals {
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("You must set home in one of four ways:\n");
msg.append(" 1) Set a servlet init parameter named home.\n");
msg.append(" 2) Add a messenger_init.xml file to your classpath, which points \n ");
msg.append(" to home. Normally, this file will be in WEB-INF/classes.\n");
msg.append(" 1) Add a messenger_init.xml file to your classpath, which points \n ");
msg.append(" to home.\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(" 4) Set the Java system property \"home\".\n\n");
......@@ -746,9 +745,9 @@ public class JiveGlobals {
}
else {
if (!mh.canRead() || !mh.canWrite()) {
Log.error("Error - the user running this Jive application can not read and write to the "
+ "specified jiveHome directory (" + home + "). Please grant the executing user "
+ "read and write perms.");
Log.error("Error - the user running this application can not read " +
"and write to the specified home directory (" + home + "). " +
"Please grant the executing user read and write permissions.");
}
}
xmlProperties = new XMLProperties(home + File.separator + "conf" +
......@@ -774,7 +773,7 @@ class InitPropLoader {
String home = null;
InputStream in = null;
try {
in = getClass().getResourceAsStream("/" + JiveGlobals.getConfigName());
in = getClass().getResourceAsStream("/messenger_init.xml");
if (in != null) {
SAXReader reader = new SAXReader();
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