源程序改为如下: import java.applet.Applet; public class DoNothing extends Applet { public void init(){ }; } 怎样去掉APPLET里面的有关本地文件操作代码?能否详细描述一下,因我是个初学者刚学没几天,多谢了!
你的问题在别人那里不能重现,大家就不容易帮你搞定,你把所有的东西重新发表一遍。 象我这样。 ================================ =源文件:myapplet\MyApplet.java= ================================ package myapplet; import java.applet.*; public class MyApplet extends Applet { public MyApplet() { } public void init() { } } ========================= =html文件:MyApplet.html= ========================= <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GBK"> <title> HTML Test Page </title> </head> <body> myapplet.MyApplet will appear below in a Java enabled browser.<br> <applet codebase = "." code = "myapplet.MyApplet.class" name = "TestApplet" width = "400" height = "300" hspace = "0" vspace = "0" align = "middle" > </applet> </body> </html> ========== =目录结构= ========== src-- |__myapplet-- |__MyApplet.java classes-- |__myapplet-- | |__MyApplet.class | |__MyApplet.html顺便检查你的ie中设置:在高级选项中,是否使用了正确的jre解释applet。
import java.applet.Applet; public class DoNothing extends Applet
{
public void init(){
}
}
CLASSPATH=C:\j2sdk1.4.2\lib\tools.jar;.;c:\j2sdk1.4.2\lib\dt.jar;你少了一个最重要的点!!!
把你的Applet里面的有关本地文件操作代码去掉,然后重新编译,即可。
import java.applet.Applet;
public class DoNothing extends Applet
{
public void init(){ };
}
怎样去掉APPLET里面的有关本地文件操作代码?能否详细描述一下,因我是个初学者刚学没几天,多谢了!
象我这样。
================================
=源文件:myapplet\MyApplet.java=
================================
package myapplet;
import java.applet.*;
public class MyApplet extends Applet {
public MyApplet() {
}
public void init() {
}
}
=========================
=html文件:MyApplet.html=
=========================
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>
HTML Test Page
</title>
</head>
<body>
myapplet.MyApplet will appear below in a Java enabled browser.<br>
<applet
codebase = "."
code = "myapplet.MyApplet.class"
name = "TestApplet"
width = "400"
height = "300"
hspace = "0"
vspace = "0"
align = "middle"
>
</applet>
</body>
</html>
==========
=目录结构=
==========
src--
|__myapplet--
|__MyApplet.java
classes--
|__myapplet--
| |__MyApplet.class
|
|__MyApplet.html顺便检查你的ie中设置:在高级选项中,是否使用了正确的jre解释applet。
比如VAJ。
或者就拿 wb_0410(天煞) 的代码比较就可以了。
还有,最大可能是你的HTML不对。
sweat y
下面是一个用word生成的html文件,里面就输入了一句话:This is a html file edited by word.但是你可以看一下它的源文件:呵呵。
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40"><head>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="word.files/filelist.xml">
<title>This is a html file edited by word</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>wangbo</o:Author>
<o:LastAuthor>wangbo</o:LastAuthor>
<o:Revision>1</o:Revision>
<o:TotalTime>1</o:TotalTime>
<o:Created>2003-09-15T05:42:00Z</o:Created>
<o:LastSaved>2003-09-15T05:43:00Z</o:LastSaved>
<o:Pages>1</o:Pages>
<o:Words>5</o:Words>
<o:Characters>31</o:Characters>
<o:Company>runway</o:Company>
<o:Lines>1</o:Lines>
<o:Paragraphs>1</o:Paragraphs>
<o:CharactersWithSpaces>35</o:CharactersWithSpaces>
<o:Version>10.2625</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:GrammarState>Clean</w:GrammarState>
<w:PunctuationKerning/>
<w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
<w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
<w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
<w:Compatibility>
<w:SpaceForUL/>
<w:BalanceSingleByteDoubleByteWidth/>
<w:DoNotLeaveBackslashAlone/>
<w:ULTrailSpace/>
<w:DoNotExpandShiftReturn/>
<w:AdjustLineHeightInTable/>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:UseFELayout/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋体;
mso-font-kerning:1.0pt;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:42.55pt;
mso-footer-margin:49.6pt;
mso-paper-source:0;
layout-grid:15.6pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";}
</style>
<![endif]-->
</head><body lang=ZH-CN style='tab-interval:21.0pt;text-justify-trim:punctuation'><div class=Section1 style='layout-grid:15.6pt'><p class=MsoNormal><span lang=EN-US>This is a html file edited by word.</span></p></div></body></html>