import java.applet.*;
import java.awt.*;
import com.ice.jni.registry.NoSuchKeyException;
import com.ice.jni.registry.RegStringValue;
import com.ice.jni.registry.Registry;
import com.ice.jni.registry.RegistryException;
import com.ice.jni.registry.RegistryKey;
public class IvoGetReg extends Applet {
public void paint(Graphics g) {
////g.drawString("你好,Java世界!", 2, 20);
try {
RegistryKey software = Registry.HKEY_CURRENT_USER
.openSubKey("Software");
RegistryKey ConKey = software.openSubKey("Continuum Data Systems");
RegistryKey IvoSystem = ConKey.openSubKey("IvoSystem");
String subKey1Value = IvoSystem.getStringValue("key0");
g.drawString(subKey1Value, 2, 20);
////String subKey2Value = software.getStringValue("key1");
//g.drawString(subKey1Value + "第二个" + subKey2Value, 2, 20);
IvoSystem.closeKey();
} catch (NoSuchKeyException e) {
e.printStackTrace();
} catch (RegistryException e) {
e.printStackTrace();
}
}
}
这个是我写的java代码
我引用了一个ICE_JNIRegistry.dll和registry.jar
<applet code="IvoGetReg.class" archive="registry.jar" name="IvoGetReg"
width=300
height=200>
</applet>
运行之后空白什么都显示不出来,如果我把java代码修改了 直接输出是可以的,但是需要访问其他的代码就不可以了。
------解决方案--------------------
用 object 标签试试。另外注意路径:
<object
classid="clsid:CAFEEFAC-0015-0000-0000-ABCDEFFEDCBA"
<param name="code" value="Applet1.class">
<comment>
<embed code="Applet1.class"
type="application/x-java-applet;jpi-version=1.5.0">
<noembed>
No Java Support.
</noembed>
</embed>
</comment>
</object>
------解决方案--------------------
你看看这个:
http://blog.csdn.net/defonds/article/details/4440697