This can be done using JNA(Java Native Access) library.
Use this link to download @ https://github.com/twall/jna#readme
Required jars:
Piece of code to test:
Here I am trying to read Android installation path from windows registry.
Here I am trying to read Android installation path from windows registry.
public static void main(String[] args) {
try {
Map<String, Object> values = Advapi32Util.registryGetValues(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Android SDK Tools");
for (String value : values.keySet()) {
System.out.println(value + " " + values.get(value));
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
try {
Map<String, Object> values = Advapi32Util.registryGetValues(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Android SDK Tools");
for (String value : values.keySet()) {
System.out.println(value + " " + values.get(value));
}
} catch (Exception e) {
e.printStackTrace();
}
}
Output:
Path D:\Work\Android\adt-bundle-windows-x86-20130522\adt-bundle-windows-x86-20130522
No comments:
Post a Comment