prueba.java

来自「How To accede Windows registry with java」· Java 代码 · 共 58 行

JAVA
58
字号
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package accesoregistro;import com.ice.jni.registry.*;import java.util.StringTokenizer;        /** * * @author TeimoyM */public class prueba {        public prueba(){        String appString = "";                RegistryKey skey = Registry.HKEY_CLASSES_ROOT;        RegistryKey mkey = Registry.HKEY_CLASSES_ROOT;        try{                    skey = skey.openSubKey("ext");        String tt = skey.getDefaultValue();        mkey = mkey.openSubKey(tt);        mkey = mkey.openSubKey("shell");        mkey = mkey.openSubKey("open");        mkey = mkey.openSubKey("command");        appString = mkey.getDefaultValue();        skey.closeKey();        mkey.closeKey();        appString = appString.replace('"',' ');        StringTokenizer st = new StringTokenizer(appString);        String sst;        StringBuffer ret = new StringBuffer();        ret.append((String)st.nextElement());        ret.append(" ");        while (st.hasMoreElements()) {            sst = (String) st.nextElement();            if ((sst.indexOf('%') == -1))                ret.append(sst + " ");        }        System.out.println(ret.toString());        }        catch(Exception e)        {            e.printStackTrace();        }    }    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?