读书人

Java 判断本土有没有安装word

发布时间: 2012-09-13 09:51:53 作者: rapoo

Java 判断本地有没有安装word

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下?

读书人网 >软件架构设计

热点推荐