0

我尝试在浏览器中启动 Applet,但它现在正在运行。在 AppletViewer 中一切正常。我将文件 .html 复制到 scr 文件夹,并尝试打开它们,我得到一个找不到的ClassNotFoundException说法:PlanZajecJavaProjektApplet.class

在此处输入图像描述

来自 html 文件的代码

<HTML>
<HEAD>
   <TITLE>Applet HTML Page</TITLE>
</HEAD>
<BODY>

<H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3>

<P>
<APPLET codebase="classes" code="PlanZajecJavaProjektApplet.class" width=350 height=200></APPLET>
</P>

<HR WIDTH="100%"><FONT SIZE=-1><I>Generated by NetBeans IDE</I></FONT>
</BODY>
</HTML>

来自java文件的代码:

import java.awt.GridBagConstraints;
import java.lang.reflect.InvocationTargetException;
import javax.swing.JButton;
import javax.swing.JTextArea;

public class PlanZajecJavaProjektApplet extends javax.swing.JApplet {
...
4

2 回答 2

0

When I run java applets, I put the .class files in the same folder that the .html is. When you do this, dont use the codebase='classes', because it means that your class files is located in a folder called 'classes' and it wont work.

于 2013-09-12T13:03:43.770 回答
0

我的错误,我移到了 build\classes 文件夹,其中有我的类文件,现在我有了这个:

在此处输入图像描述

在此处输入图像描述

于 2013-06-08T10:15:57.210 回答