import java.io.File;
import ca.beq.util.win32.registry.RegistryKey;
import ca.beq.util.win32.registry.RootKey;
public class test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
RegistryKey r = new RegistryKey(RootKey.HKEY_CURRENT_USER, "Software\\Microsoft\\Office\\11.0\\Word\\Options");
String path = r.getValue("PROGRAMDIR").getStringValue();
if(path!=null){
if (new File(path + "WINWORD.EXE").isFile())
{
System.out.println("安装过word");
}else{
System.out.println("没安装过word");
}
}else{
System.out.println("没安装过word");
}
}
}
需要用到jRegistryKey.jar,下载链接http://nchc.dl.sourceforge.net/project/jregistrykey/binaries/1.4.0/jRegistryKey-bin-1.4.0.zip
补充:
dll需要拷贝到C:\WINDOWS\system32下
dll需要拷贝到C:\WINDOWS\system32下