E aí pessoal, blz?!!!
Eu dei uma pesquisada antes de postar esta dúvida e o pessoal aconselha muito a usar Preferences quando se deseja ler informações do registro do Windows.
Só que Preferences não é suportada pela MVM ( Microsoft Virtual Machine ) que é a 1.1 e meu código tem que ser feito para rodar nesta VM.
Tentei o código abaixo mas não está funcionando.
private static final String REGQUERY_UTIL = "reg query ";
private static final String REGSTR_TOKEN = "REG_SZ";
private static final String HK_PC = REGQUERY_UTIL +
"\"HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0\" /v ProcessorNameString";
try{
String m_sDialer;
Process proc = Runtime.getRuntime().exec(HK_PC);
InputStream is = proc.getInputStream();
StringWriter sw = new StringWriter();
int iRet;
while ((iRet = is.read()) != -1){sw.write(iRet);}
iRet = sw.toString().indexOf(REGSTR_TOKEN);
if (iRet == -1) m_sDialer = null;
else m_sDialer = sw.toString().substring(iRet + REGSTR_TOKEN.length()).trim();
}
catch(IOException e){
System.out.println(e.getMessage());
System.out.println(e.toString());
}
Será que a sintaxe está errada do comando? Tá dando erro=2 na linha com Runtime.getRuntime().exec(HK_PC);