applet在jbuilder环境下没问题,用ie调用出applet can't be instantiated,什么原因呢? 你的调用Applet的网页源码呢??贴出来!估计:1.使用了Java2,没有安装Java插件。2.安装了Java插件,但是网页用的是Applet标签,不是Object。先得知道你出错的原因才能解答。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <applet codebase = "." code = "huadi.TestApplet1.class" name = "TestApplet" width = "400" height = "300" hspace = "0" vspace = "0" align = "middle"></applet>package huadi;import java.awt.*;import java.awt.event.*;import java.applet.*;import java.io.*;import java.net.*;import javax.swing.*;public class TestApplet1 extends JApplet implements Runnable { private boolean isStandalone = false; private JTextField messageText = new JTextField(); Thread animator; int frame; int delay; String message; //Get a parameter value public String getParameter(String key, String def) { return isStandalone ? System.getProperty(key, def) : (getParameter(key) != null ? getParameter(key) : def); } public TestApplet1() {} public void start() { animator = new Thread(this); animator.start(); } public void run() { while (Thread.currentThread() == animator) { repaint(); try { Thread.sleep(delay); } catch (InterruptedException e) { break; } frame++; } } public int getNumber(){ try { URL url = new URL("http://127.0.0.1:8080/huadiOfficeSystem/getThreadList.jsp"); java.net.URLConnection connect = url.openConnection(); connect.setUseCaches(false); //System.out.println("connection start"); //showStatus("open connection!"); //下次连接不用Cache connect.setDefaultUseCaches(false); //这次连接也不用Cache //connect.setUseCaches(false); //打开?流用于读数据 //connect.setDoInput(true); //不能用于写数据 //connect.setDoOutput(false); //服务器与客户的真正连接 //connect.connect(); //p("Made connection to "+connect); //showStatus("Open Stream!"); DataInputStream in = new DataInputStream(connect.getInputStream()); //showStatus("reading!"); message = in.readLine(); in.close(); }catch(MalformedURLException e2) { //System.err.println("MalformedURLException!"); //e2.printStackTrace(System.err); //showStatus("MalformedURLException!"); }catch(IOException e1) { //System.err.println("IOException!"); //e2.printStackTrace(System.err); //showStatus("IOException"); } int l = Integer.parseInt(message); return l; } public void paint(Graphics g) { Color bg = getBackground(); int l = getNumber(); g.setColor(Color.black); g.drawRect(10,100,5*l,20); g.drawString("现在+ l +" 用户", 10, 140); oldNumber = l; } //Initialize the applet public void init() { try { jbInit(); delay = 2000; } catch(Exception e) { //e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { } public String getAppletInfo() { return "Applet Information"; } //Get parameter info public String[][] getParameterInfo() { return null; } void messageText_actionPerformed(ActionEvent e) { }}我是新手,请多多帮助,谢谢 你的Applet的class文件放在那里了?不能放在WEB-INF/classes目录下. 在线跪求实现方案 系统公告的实时显示 servlet生成xml的问题 怎样在.properties文件中注释? 在struts的action中得到了BufferedImage对象,我要如何将其显示在jsp页面上呢? iRport 启动不了是为什么? 一个页面技巧,请教 小弟跪问JSP问题 关于tomcat启动目录配置的问题 小问题,多些支持 谁知道用什么软件能制作短信图片、彩信图片、铃声,100分相赠! 如何将从JSP页面中取得的系统当前时间写入oracle数据库表中? <table></table>能不能做成透明的?
codebase = "."
code = "huadi.TestApplet1.class"
name = "TestApplet"
width = "400"
height = "300"
hspace = "0"
vspace = "0"
align = "middle"
>
</applet>
package huadi;import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.io.*;
import java.net.*;
import javax.swing.*;public class TestApplet1 extends JApplet implements Runnable {
private boolean isStandalone = false;
private JTextField messageText = new JTextField();
Thread animator;
int frame;
int delay;
String message; //Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
} public TestApplet1() {} public void start() {
animator = new Thread(this);
animator.start();
} public void run() {
while (Thread.currentThread() == animator) {
repaint(); try {
Thread.sleep(delay);
} catch (InterruptedException e) {
break;
} frame++;
}
} public int getNumber(){
try {
URL url = new URL("http://127.0.0.1:8080/huadiOfficeSystem/getThreadList.jsp");
java.net.URLConnection connect = url.openConnection();
connect.setUseCaches(false);
//System.out.println("connection start");
//showStatus("open connection!");
//下次连接不用Cache connect.setDefaultUseCaches(false);
//这次连接也不用Cache
//connect.setUseCaches(false);
//打开?流用于读数据
//connect.setDoInput(true);
//不能用于写数据
//connect.setDoOutput(false);
//服务器与客户的真正连接
//connect.connect();
//p("Made connection to "+connect);
//showStatus("Open Stream!");
DataInputStream in = new DataInputStream(connect.getInputStream());
//showStatus("reading!");
message = in.readLine(); in.close();
}catch(MalformedURLException e2)
{
//System.err.println("MalformedURLException!");
//e2.printStackTrace(System.err);
//showStatus("MalformedURLException!");
}catch(IOException e1)
{
//System.err.println("IOException!");
//e2.printStackTrace(System.err);
//showStatus("IOException");
} int l = Integer.parseInt(message);
return l;
}
public void paint(Graphics g) {
Color bg = getBackground();
int l = getNumber();
g.setColor(Color.black);
g.drawRect(10,100,5*l,20);
g.drawString("现在+ l +" 用户", 10, 140);
oldNumber = l;
} //Initialize the applet
public void init() {
try {
jbInit(); delay = 2000;
}
catch(Exception e) {
//e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
}
public String getAppletInfo() {
return "Applet Information";
}
//Get parameter info
public String[][] getParameterInfo() {
return null;
} void messageText_actionPerformed(ActionEvent e) { }
}
我是新手,请多多帮助,谢谢
不能放在WEB-INF/classes目录下.