怪事,jdk1.4编译的Applet不能用,但是jdk1.4可以(100分)

  • 主题发起人 主题发起人 firesword
  • 开始时间 开始时间
F

firesword

Unregistered / Unconfirmed
GUEST, unregistred user!
我安装了j2sdk1.4.0-beta3后,发现里面的demo都不能用,就是用jdk1.4编译好的applet不能显示出来,比如下面这个例子
import java.awt.*;
import java.applet.*;
public class DrawText extends Applet {
String s;
Button btnFirst=new Button("first");
Button btnSecond=new Button("second");
TextField txtfldFirst=new TextField("zhuzhu",20);
int inits=0;
int starts=0;
int stops=0;
int paints=0;
public void start(){starts++;}
public void stop(){stops++;}
public void init(){
inits++;
add(btnFirst);
add(btnSecond);
add(txtfldFirst);
}
public void paint(Graphics g){
paints++;
g.drawString("asdlfkjalsdf",10,110);
g.draw3DRect(0,100,100,20,true);
s="inits="+inits+" starts="+starts+" stops="+stops+" paints="+paints;
g.drawString(s,10,130);
}
public boolean action(Event evt,Object arg){
if (evt.target.equals(btnFirst)){
FileDialog d=new FileDialog(null,"测试");
d.show();
}
else
{
return super.action(evt,arg);
}
return true;
}
}
//html文件为
<html>
<head>
<title>test using applets(1.1)</title>
</head>
<body>
<applet code="DrawText.class" width=300 height=200>
</applet>
</body>
</html>
但是用jdk1.3编译的applet可以正确的显示.
 
Maybe JRE problem, try to use jave console to see the error message,
 
是JRE问题
你的html文件中最好使用OBJECT替代APPLET引用
这样可以避开MS的JVM
具体就是使用 d:/htmlconverter MyHtml.html 转换一下
 
用HtmlConverter.exe转换html后,出现的问题为只要打开那个html文件
IE就自动退出了,请问一下怎样解决.
控制面板中的Java Plug-in 1.4.0不能运行
可能的原因是什么呢?
我在IE的属性高级中看到的设置为
Use Java 2 v1.4.0 for <applet>.
注册表文件如下
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft]
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit]
"CurrentVersion"="1.4"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/1.3]
"JavaHome"="C://jdk1.3"
"MicroVersion"="0"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/1.3.0]
"JavaHome"="C://jdk1.3"
"MicroVersion"="0"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/1.4]
"JavaHome"="C://j2sdk1.4.0-beta3"
"MicroVersion"="0"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/1.4.0 beta3]
"JavaHome"="C://j2sdk1.4.0-beta3"
"MicroVersion"="0"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Plug]
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Plug/1.3]
"JavaHome"="D://tools//JBuilder4//jdk1.3//jre"
"RuntimeLib"="D://tools//JBuilder4//jdk1.3//jre//bin//classic//jvm.dll"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Plug/1.3.0_02]
"JavaHome"="C://Program Files//JavaSoft//JRE//1.3.0_02"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Plug/1.4]
"JavaHome"="C://Program Files//Java//j2re1.4.0-beta3"
"UseJava2IExplorer"=dword:00000001
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Plug/1.4.0]
"JavaHome"="C://Program Files//Java//j2re1.4.0-beta3"
"UseJava2IExplorer"=dword:00000001
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Plug-in]
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Plug-in/1.3]
"JavaHome"="D://tools//JBuilder4//jdk1.3//jre"
"RuntimeLib"="D://tools//JBuilder4//jdk1.3//jre//bin//classic//jvm.dll"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Plug-in/1.3.0_02]
"JavaHome"="C://Program Files//JavaSoft//JRE//1.3.0_02"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Plug-in/1.4]
"JavaHome"="C://Program Files//Java//j2re1.4.0-beta3"
"UseJava2IExplorer"=dword:00000001
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Plug-in/1.4.0]
"JavaHome"="C://Program Files//Java//j2re1.4.0-beta3"
"UseJava2IExplorer"=dword:00000001
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Runtime Environment]
"CurrentVersion"="1.4"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Runtime Environment/1.3]
"JavaHome"="C://Program Files//JavaSoft//JRE//1.3.0_02"
"MicroVersion"="0"
"RuntimeLib"="C://Program Files//JavaSoft//JRE//1.3.0_02//bin//hotspot//jvm.dll"
"UpdateVersion"="000"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Runtime Environment/1.3.0]
"JavaHome"="C://Program Files//JavaSoft//JRE//1.3.0_02"
"MicroVersion"="0"
"RuntimeLib"="C://Program Files//JavaSoft//JRE//1.3.0_02//bin//hotspot//jvm.dll"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Runtime Environment/1.4]
"JavaHome"="C://Program Files//Java//j2re1.4.0-beta3"
"MicroVersion"="0"
"RuntimeLib"="C://Program Files//Java//j2re1.4.0-beta3//bin//client//jvm.dll"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Runtime Environment/1.4.0 beta3]
"JavaHome"="C://Program Files//Java//j2re1.4.0-beta3"
"MicroVersion"="0"
"RuntimeLib"="C://Program Files//Java//j2re1.4.0-beta3//bin//client//jvm.dll"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Web Start]
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Web Start/1.0.1]
"Home"="C://Program Files//Java Web Start"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java 运行时环境]
"CurrentVersion"="1.4"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java 运行时环境/1.3]
"JavaHome"="C://Program Files//JavaSoft//JRE//1.3.0_02"
"MicroVersion"="0"
"RuntimeLib"="C://Program Files//JavaSoft//JRE//1.3.0_02//bin//hotspot//jvm.dll"
"UpdateVersion"="000"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java 运行时环境/1.3.0]
"JavaHome"="C://Program Files//JavaSoft//JRE//1.3.0_02"
"MicroVersion"="0"
"RuntimeLib"="C://Program Files//JavaSoft//JRE//1.3.0_02//bin//hotspot//jvm.dll"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java 运行时环境/1.4]
"JavaHome"="C://Program Files//Java//j2re1.4.0-beta3"
"MicroVersion"="0"
"RuntimeLib"="C://Program Files//Java//j2re1.4.0-beta3//bin//client//jvm.dll"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java 运行时环境/1.4.0 beta3]
"JavaHome"="C://Program Files//Java//j2re1.4.0-beta3"
"MicroVersion"="0"
"RuntimeLib"="C://Program Files//Java//j2re1.4.0-beta3//bin//client//jvm.dll"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/java插件]
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/java插件/1.3]
"JavaHome"="D://tools//JBuilder4//jdk1.3//jre"
"RuntimeLib"="D://tools//JBuilder4//jdk1.3//jre//bin//classic//jvm.dll"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/java插件/1.3.0_02]
"JavaHome"="C://Program Files//JavaSoft//JRE//1.3.0_02"
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/java插件/1.4]
"JavaHome"="C://Program Files//Java//j2re1.4.0-beta3"
"UseJava2IExplorer"=dword:00000001
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/java插件/1.4.0]
"JavaHome"="C://Program Files//Java//j2re1.4.0-beta3"
"UseJava2IExplorer"=dword:00000001
[HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Prefs]
 
多人接受答案了。
 
后退
顶部