Redian新闻
>
Re: 关于APPLET的IO问题
avatar
Re: 关于APPLET的IO问题# Java - 爪哇娇娃
l*d
1
我试了一下,没问题呀。就是IE5的VM好像不合spec,getDocumentBase()连文件名都返回了。所以做了点改动。这是我试验的Code,你参考一下。
MyApplet.java:
import java.io.*;
import java.net.*;
import java.awt.*;
import java.applet.*;
public class MyApplet extends Applet
{
public void init()
{
setLayout(null);
setSize(426,266);
add(textArea1);
textArea1.setBounds(20,20,600,440);
textArea1.setText(getDocumentBase()+"\n");
try {
URL url = new URL(getDocumentBase(), "text.txt");
textArea1.setText(url.toString()+"\n");
URLConnection conn = url.openConnection()
avatar
x*n
2
You may edit a policy file by yourself to grant certain
permission. Then use the command:
appletviewer -J-Djava.security.policy=MyPolicyFile.txt MyApplet.html
to test ur code.
If you want to deploy your applet via web-browser, signing
code is a better alternative, i think.
goodluck
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。