title: Making folder that will be accessable in jar
body: <p>I want an option that when ever user selects autologin option...My program will make a folder and it will save a file in it...when the program will start it will look for folder and than file inside it. Problem is when i run my code via netbeans it is running perfectly but when i run it through jar it do not find any folder. Any body can guide me, what is best way to make a folder at run time and access it.
  Down is my file writing code...</p>
  
  <pre><code>private void writeSerializableUserObject(boolean isAutoLogin , boolean isAutoRemember){
      SerializableUser serializeUserObj = new SerializableUser();
      serializeUserObj.setUserEmail(TempSessionUser.getTempUser().getEmail());
      serializeUserObj.setUserPassword(TempSessionUser.getTempUser().getPassword());
      serializeUserObj.setUserName(TempSessionUser.getTempUser().getF_name());
      serializeUserObj.setIsAutoLogin(isAutoLogin);
      if(isAutoRemember){
          serializeUserObj.setIsAutoRemember(true);
      }
      System.out.println("in side method.......");
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <pre><code>    String path = System.getProperty("user.home");
      File file = new File(path+"/user.ser");
      if(!file.exists()){
            file.mkdir();
      }
      try {
          FileOutputStream fileOutPut = new FileOutputStream(file);
          ObjectOutputStream oos;
          try {
              oos = new ObjectOutputStream(fileOutPut);
              oos.writeObject(serializeUserObj);
              oos.flush();
              oos.close();
          } catch (IOException ex) {
              Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
          }//Inner catch statment end
  
      } catch (FileNotFoundException ex) {
          Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
      }//Outer Catch statment end
  }
  </code></pre>
  
  <p>After editing it is giving me this exception...within netbeans execution.her uptill HaseebAimal is my home directory path</p>
  
  <pre><code>    java.io.FileNotFoundException: C:\Users\HaseebAimal\UserData\user.ser (Access is denied)
  
      at java.io.FileOutputStream.open(Native Method)
  at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:194)
  at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:145)
  </code></pre>