title: How to save a image using ImageIO.write() in Linux?
body: <p>I wanted to save image to user machine while he is launching my java application. for this i have written code as follows :</p>
  
  <pre><code>BufferedImage image = null;
          try {
  
              URL url = new URL(logourl);
              image = ImageIO.read(url);
  
              ImageIO.write(image, "png",new File("/usr/swa.png"));
  
          } catch (IOException e) {
              e.printStackTrace();
          }
  </code></pre>
  
  <p>But it is giving me </p>
  
  <pre><code>java.io.FileNotFoundException: /usr/swa.png (Permission denied)
  </code></pre>
  
  <p>but if i used  </p>
  
  <pre><code>ImageIO.write(image, "png",new File("/home/MyUserName/Desktop/applicationName/logo.png"));
  </code></pre>
  
  <p>Then it saving the image.
  i dont get why it is not accessing that path if it working for <code>/home/MyUserName/Desktop/applicationName/logo.png</code> this path.</p>
  
  <p>basically when user install application i want fetch image from web url and save it to user's local machine so what i need to to achieve this??</p>
  
  <p>EDIT : Exception  corrected</p>