首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Java 判断本土有没有安装word

2012-09-13 
Java 判断本地有没有安装wordimport java.io.Fileimport ca.beq.util.win32.registry.RegistryKeyimport

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

热点排行