public class gx extends Applet implements Runnable{
......................................
   private static final File file=new File("d:\\dd.txt");
........................................
........................................
........................................
}   
 怎么没出来?:顶者有分

解决方案 »

  1.   

    applet 不能对本地进行直接的操作
      

  2.   

    那我如果想保存applet里面的东西到的文件怎么办啊???
      

  3.   

    只有获得安全签名的applet才能对磁盘进行操作
      

  4.   

    一般不建议使用applet做这个操作
      

  5.   

    FilePermission p = new FilePermission("d:\\dd.txt", "read,write");    
    书上上这么写的获取安全签名
    我怎么写怎么还没出来  
     private static final File file=new File("d:\\dd.txt");
     
      

  6.   

    我也遇到和你差不多的问题,我用一下方法做人自己的
    安全签名:
    1:jar 把applet所有文件打包
    2:keytool 来生成key
    3:把生成的key给那个打包的文件就可以了
    这是我看的原文希望有所帮助:
    Signing JAR Files with a Test Certificate
    Here are the steps needed to sign a JAR file with a test certificate: 
    1. Make sure that you have a JDK 1.2 or JDK 1.3 keytool and jarsigner in your path (located in the J2SE SDK bin directory). 
    2. use jar -csf (the name wanted).jar   *.*
    3. this will make all the file inside this directory created in the new file
    4. Create a new key in a new keystore as follows: 
    keytool -genkey -keystore myKeystore -alias myself 
    You will get prompted for a information about the new key, such as password, name, etc. This will create the myKeystore file on disk. A self-signed test certificate also will be created. 
    5. Check to make sure that everything is ok. To list the contents of the keystore, use the command: 
    keytool -list -keystore myKeystore 
    It should list something like: 
    Keystore type: jks
    Keystore provider: SUN
    Your keystore contains 1 entry:
    myself, Tue Jan 23 19:29:32 PST 2001, keyEntry,
    Certificate fingerprint (MD5):
    C2:E9:BF:F9:D3:DF:4C:8F:3C:5F:22:9E:AF:0B:42:9D
    6. Finally, sign the JAR file with the test certificate as follows: 
    jarsigner -keystore myKeystore test.jar myself 
    Repeat this step on all of your JAR files. 
    Please note that a self-signed test certificate should only be used for internal testing, since it does not provide any guarantees about the identity of the user and therefore cannot be trusted. A trust-worthy certificate can be obtained from a certificate authority, such as VeriSign, and should be used when the application is put into production.