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

[macos] We can't choose files in Desktop folder via JFileChooser

XMLWordPrintable

    • aarch64
    • os_x

      ADDITIONAL SYSTEM INFORMATION :
      I've downloaded jdk 17.0.1 for aarch64 at https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html

      macOS Monterey 12.0.1 (21A559)
      Apple M1 Max
      MacBook Pro 2021

      java version "17.0.1" 2021-10-19 LTS
      Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
      Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      We can't choose files in Desktop folder via JFileChooser on aarch64 macOS Monterey 12.0.1 (21A559)


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. download SimpleJFileChosser.1.jar from https://gist.github.com/c25c67cff0272792f57af3596f11dc08 (click view raw to download)
      2. left click and open with JavaLauncher (please do not test with java -jar. it works)
      3. in the Open dialog, double-click Desktop, Downloads, or Documents


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      list the files in the Desktop
      ACTUAL -
      not files are listed

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;

      public class SimpleJFileChosser {
          public static void main(String[] args) {
              JFileChooser dirChooser = new JFileChooser();
              dirChooser.setFileHidingEnabled(false);
              dirChooser.showOpenDialog(null);
              JOptionPane.showMessageDialog(null, "provided path is " + dirChooser.getSelectedFile().getPath());
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            psadhukhan Prasanta Sadhukhan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: