SUGGESTED FIX
Here are the diffs the webrev is also attached, tested on win-x86 and win-x64
*** /tmp/geta10114 Wed Mar 12 16:39:42 2008
--- /tmp/getb10114 Wed Mar 12 16:39:42 2008
***************
*** 19,24 ****
--- 19,28 ----
class Util {
private static boolean verbose = (System.getProperty("servicetag.verbose") != null);
private static String jrepath = null;
+ private static final String REGKEY_END =
+ "microsoft\\windows\\currentversion\\app paths\\stclient.exe";
+ private static final String STCLIENT_END = "Sun\\servicetag\\stclient.exe";
+ private static final String WIN32_STCLIENT = "c:\\Program Files (x86)\\" + STCLIENT_END;
// for debugging and tracing
static boolean isVerbose() {
***************
*** 198,209 ****
* Gets the stclient path using a well known location from
* the Windows platform Registry, otherwise it will return null.
*/
! static File getWindowsStClientFile() {
File out = null;
! String regKey = "software\\microsoft\\windows\\currentversion\\app paths\\stclient.exe";
String keyName = "" ; // use the default key
String path = getRegistryKey(regKey, keyName);
-
if (path != null && (new File(path)).exists()) {
out = new File(path);
}
--- 202,214 ----
* Gets the stclient path using a well known location from
* the Windows platform Registry, otherwise it will return null.
*/
! private static File getWindowsStClientFile(boolean wow64) {
File out = null;
! String regKey = (wow64 == true)
! ? "software\\Wow6432Node\\" + REGKEY_END
! : "software\\" + REGKEY_END;
String keyName = "" ; // use the default key
String path = getRegistryKey(regKey, keyName);
if (path != null && (new File(path)).exists()) {
out = new File(path);
}
***************
*** 213,218 ****
--- 218,258 ----
return out;
}
+ /**
+ * Finds a stclient in 32 and 64 bit environments, first by querying
+ * the windows registry, if not then get the well known paths for
+ * 64bit see http://support.microsoft.com/kb/896459
+ */
+
+ static File getWindowsStClientFile() {
+ File stclient = null;
+
+ // try to get the default entry
+ stclient = getWindowsStClientFile(false);
+ if (stclient != null) {
+ return stclient;
+ }
+
+ // we might be on x64, then try the wow64 area
+ stclient = getWindowsStClientFile(true);
+ if (stclient != null) {
+ return stclient;
+ }
+
+ // try the default hard coded path, maybe wow64 registry is missing
+ stclient = new File(WIN32_STCLIENT);
+ if (stclient.canExecute()) {
+ if (isVerbose()) {
+ System.out.println("stclient(default)=" + stclient);
+ }
+ return stclient;
+ }
+ if (isVerbose()) {
+ System.out.println("stclient not found");
+ }
+ return null;
+ }
+
/**
* This uses reflection to access a private java windows registry
* interface, any changes to that Class must be appropriately adjusted.
|