用jRegistry 来操作注册表 jRegistry它是用JNI来封装WINDOWS注册表API,方便了java开发者访问windows注册表。首先介绍一下jRegistryKey.jar和jRegistryKey.dll,这两个文件是使用jRegistry来操作注册表所必需的文件:一个是jar包,是一个包括了java类的文件;一个是动态链接库文件,提供了访问注册表所需的本地代码(即C/C++)。 下面详细介绍一下使用流程: 1、 在JBuilder的菜单Project->Project Properties->Required Libraries中添加jRegistryKey.jar或在环境变量classpath中添加该jar文件; 2、 将jRegistryKey.dll放在工程的当前目录下; 3、 在访问注册表类中import该语句:import ca.beq.util.win32.registry.*; 该包中有两个类:RegistryKey和RegistryValue。其中RegistryKey是注册表键的java表示,它提供了creat()和delete()方法创建和删除key,枚举子键和值,set和get键的值等;RegistryValue is the Java? representation of a registry value (defined as a name, a type, and data).import ca.beq.util.win32.registry.*; public static void test5() { // RegistryKey r = new RegistryKey(RootKey.HKLM, "SOFTWARE\\Ghostgum\\GSview"); if(r.hasValue("4.9")) { RegistryValue v = r.getValue("4.9"); System.out.println(v.toString());// System.out.println("-----------------------------");
date_default_timezone_set('PRC');// 设置默认时区为:北京时间。
$mytime = time();
echo date('Y-m-d H:i:s',$mytime);
?>
或
date_default_timezone_set("UTC")然后,根据用户的不同时区显示时间。
jRegistry它是用JNI来封装WINDOWS注册表API,方便了java开发者访问windows注册表。首先介绍一下jRegistryKey.jar和jRegistryKey.dll,这两个文件是使用jRegistry来操作注册表所必需的文件:一个是jar包,是一个包括了java类的文件;一个是动态链接库文件,提供了访问注册表所需的本地代码(即C/C++)。
下面详细介绍一下使用流程:
1、 在JBuilder的菜单Project->Project Properties->Required Libraries中添加jRegistryKey.jar或在环境变量classpath中添加该jar文件;
2、 将jRegistryKey.dll放在工程的当前目录下;
3、 在访问注册表类中import该语句:import ca.beq.util.win32.registry.*; 该包中有两个类:RegistryKey和RegistryValue。其中RegistryKey是注册表键的java表示,它提供了creat()和delete()方法创建和删除key,枚举子键和值,set和get键的值等;RegistryValue is the Java? representation of a registry value (defined as a name, a type, and data).import ca.beq.util.win32.registry.*;
public static void test5() { //
RegistryKey r = new RegistryKey(RootKey.HKLM, "SOFTWARE\\Ghostgum\\GSview");
if(r.hasValue("4.9")) {
RegistryValue v = r.getValue("4.9");
System.out.println(v.toString());//
System.out.println("-----------------------------");
System.out.println(v.getData().toString());
} }