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

File.delete() does not work for directories on solaris

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.4

      Description

      File.delete() does not work for directories on solaris

      see code example below. Works for files, but not for directories.

      import java.io.*;
       
      // makes use of the File class
       
      class deletefile {
       
              public static void main(String args[]) {
                      boolean filedeleted = true;
                      File Filo = new File(args[0]);
                      System.out.println ("Path sep " + Filo.pathSeparator );
                      filedeleted = Filo.delete ();
                      System.out.println ( "filedeleted = " + filedeleted );
              }
      }

      $ java deletefile testfile
      Path sep :
      filedeleted = true
      /home/kammy/testprogs/jh (kokomo)
      $ ls testfile
      testfile: No such file or directory

      /home/kammy/testprogs/jh (kokomo)
      $ java deletefile testdir2
      Path sep :
      filedeleted = false
      /home/kammy/testprogs/jh (kokomo)
      $ ls
      deletefile.class fileOps.java testdir/
      deletefile.java fileOpsMain.java testdir2/

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mr Mark Reinhold
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: