想让jsp页面中的applet调用本机的可执行文件,而不是服务器上面的这个文件,应该如何实现那?

解决方案 »

  1.   

    同样的问题被我遇到,在IDE中调试applet时是可以调用本地可执行程序的,但将其嵌入到html页面终究不能调用了,郁闷啊!
    不知搂主解决了没有?
      

  2.   

    JAVA的网站上有例子,不过我还没看明白,我发给你看看
    import java.awt.*;
    import java.io.*;
    import java.lang.*;
    import java.applet.*;public class writeFile extends Applet {
        String myFile = "/tmp/foo";
        File f = new File(myFile);
        DataOutputStream dos;  public void init() {
        
        String osname = System.getProperty("os.name");
        if (osname.indexOf("Windows") != -1) {
          myFile="tmpfoo";
        }
      }  public void paint(Graphics g) {
    try {
         dos = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(myFile),128));
      dos.writeChars("Cats can hypnotize you when you least expect it\n");
      dos.flush();
      g.drawString("Successfully wrote to the file named " + myFile + " -- go take a look at it!", 10, 10);   String name = System.getProperty("user.name");
      g.drawString("And, successfully got user.name ..." + name, 10, 30);
    }
    catch (SecurityException e) {
      g.drawString("writeFile: caught security exception", 10, 10);
            }
    catch (IOException ioe) {
    g.drawString("writeFile: caught i/o exception", 10, 10);
            }
       }
    }
    这个是可以写本地文件。
      

  3.   

    好象applet 有个沙盒技术,,,不允许读写本地文件的,
    除非你配置安全权限
      

  4.   

    不要配置吧,把你写的class 先打包成JAR文件,在用KEYTOOL 生成一个密钥,再对JAR文件进行签名就可以了,,