Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4406042

File.deleteOnExit() doesn't work in java plug-in.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.3.0
    • deploy
    • x86
    • windows_98



      Name: yyT116575 Date: 01/18/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


      i have write the follow code and try to run it in appletviewer and plug-in


      --- VcApplet.java ---
      /*
      <applet archive=VcApplet.jar code=VcApplet.class
      width=100 height=100>
      </applet>
      */


      import java.io.*;
      import javax.swing.*;
      import java.awt.*;

      public class VcApplet extends JApplet {
        public void init() {
          System.out.println("Calling init()...");
          File tmpFile;
          FileOutputStream fos;
          DataOutputStream dos;
          byte b[];
          int rc;
          b = new byte[200];

          try {
            tmpFile = File.createTempFile("abc", ".tmp");
            System.out.println("Path=" + tmpFile.getPath() + "Name=" + tmpFile.getName());
            tmpFile.deleteOnExit();

            fos = new FileOutputStream(tmpFile);
            dos = new DataOutputStream(fos);

            dos.write(b, 0, 200);
            dos.close();

          } catch (Exception e) {
            e.printStackTrace();
          }

        }

        public void destroy() {
          System.out.println("Calling destroy()...");
        }
      }
      --- end here ---

      I signed it and run it in both appletviewer and netscape with Java plug-in
      1.3.0-C.

      The 'tmpFile' is not removed when run in Java plug-in even after I completely
      closed the netscape. It works find with appletviewer.
      (Review ID: 108361)
      ======================================================================

            mafishersunw Margarita Fisher (Inactive)
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: