l******d 发帖数: 1 | 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() | x***n 发帖数: 291 | 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 |
|