5

Please do not mark this question as duplicate!

I'm searching for a solution in java - not C# - and used the WinRegistry class.

I wrote a program that can readout a registry key. Now the problem: the java application is 32bit and I want to read the reg-keys from a windows 7 64bit-system. With this code windows will redirect my 32bit program to the 32bit section of the 64bit-registry (compare the real path with the comment in the code - Wow6432Node!).

// only access to "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run"
value = WinRegistry.readString(WinRegistry.HKEY_LOCAL_MACHINE,
    "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", "Citrix Login Service");

I deleted the try-catch-block so you are able to focus the real problem more better ;).

4

1 回答 1

7

我现在解决了这个问题 - 感谢 Petrucio,他在 2012 年发布了这个解决方案:read/write to Windows Registry using Java

例如 - 读取操作:

try { 
  String value = WinRegistry.readString(WinRegistry.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", "TestValue", WinRegistry.KEY_WOW64_64KEY);
  System.out.println(value);
} catch (Exception ex) {
  ex.printStackTrace(); 
}

我希望这对某人有用。

于 2013-07-30T08:14:14.097 回答