Allow a debug.txt file to be created in the application directory that triggers
the use of java.exe on Windows so that we can generate thread dumps by entering Ctrl-Break in that window.
This commit is contained in:
@@ -311,6 +311,10 @@ public class Application
|
||||
}
|
||||
}
|
||||
|
||||
// look for a debug.txt file which causes us to run in java.exe on
|
||||
// Windows so that we can obtain a thread dump of the running JVM
|
||||
_windebug = getLocalPath("debug.txt").exists();
|
||||
|
||||
// parse and return our application config
|
||||
UpdateInterface ui = new UpdateInterface();
|
||||
_name = ui.name = (String)cdata.get("ui.name");
|
||||
@@ -399,7 +403,7 @@ public class Application
|
||||
ArrayList args = new ArrayList();
|
||||
|
||||
// reconstruct the path to the JVM
|
||||
args.add(LaunchUtil.getJVMPath());
|
||||
args.add(LaunchUtil.getJVMPath(_windebug));
|
||||
|
||||
// add the classpath arguments
|
||||
args.add("-classpath");
|
||||
@@ -417,7 +421,8 @@ public class Application
|
||||
String proxyHost;
|
||||
if ((proxyHost = System.getProperty("http.proxyHost")) != null) {
|
||||
args.add("-Dhttp.proxyHost=" + proxyHost);
|
||||
args.add("-Dhttp.proxyPort=" + System.getProperty("http.proxyPort"));
|
||||
args.add("-Dhttp.proxyPort=" +
|
||||
System.getProperty("http.proxyPort"));
|
||||
}
|
||||
|
||||
// pass along any pass-through arguments
|
||||
@@ -761,6 +766,7 @@ public class Application
|
||||
protected URL _vappbase;
|
||||
protected String _class;
|
||||
protected String _name;
|
||||
protected boolean _windebug;
|
||||
|
||||
protected ArrayList _codes = new ArrayList();
|
||||
protected ArrayList _resources = new ArrayList();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: LaunchUtil.java,v 1.1 2004/08/03 03:29:58 mdb Exp $
|
||||
// $Id$
|
||||
|
||||
package com.threerings.getdown.util;
|
||||
|
||||
@@ -17,21 +17,39 @@ public class LaunchUtil
|
||||
* Reconstructs the path to the JVM used to launch this process.
|
||||
*/
|
||||
public static String getJVMPath ()
|
||||
{
|
||||
return getJVMPath(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reconstructs the path to the JVM used to launch this process.
|
||||
*
|
||||
* @param windebug if true we will use java.exe instead of javaw.exe on
|
||||
* Windows.
|
||||
*/
|
||||
public static String getJVMPath (boolean windebug)
|
||||
{
|
||||
String apbase = System.getProperty("java.home") +
|
||||
File.separator + "bin" + File.separator;
|
||||
String apath = apbase + "java";
|
||||
if (!new File(apath).exists()) {
|
||||
if (new File(apath).exists()) {
|
||||
return apath;
|
||||
}
|
||||
|
||||
if (!windebug) {
|
||||
apath = apbase + "javaw.exe";
|
||||
if (!new File(apath).exists()) {
|
||||
apath = apbase + "java.exe";
|
||||
if (!new File(apath).exists()) {
|
||||
Log.warning("Unable to find java! [jhome=" + apbase + "].");
|
||||
apath = apbase + "java";
|
||||
}
|
||||
if (new File(apath).exists()) {
|
||||
return apath;
|
||||
}
|
||||
}
|
||||
return apath;
|
||||
|
||||
apath = apbase + "java.exe";
|
||||
if (new File(apath).exists()) {
|
||||
return apath;
|
||||
}
|
||||
|
||||
Log.warning("Unable to find java! [jhome=" + apbase + "].");
|
||||
return apbase + "java";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user