How to create a hidden file in any OS using Java
问题 I have this code trying to create and write in my Json File, but how can I do it Hidden in any OS (Windows or Mac) File file = new File(System.getProperty("user.home") + File.separator + "Documents" + File.separator + "targetappConfig.json"); if (!(file.exists())) { org.json.simple.JSONArray userDetails = new org.json.simple.JSONArray(); userDetails.add(userDetail); jsonObj.put("users", userDetails); FileWriter fileWriter = new FileWriter(file); fileWriter.write(jsonObj.toString());