title: write.xlsx function gives error when defining path with the file name but read.xlsx is fine
body: <p>I have a problem with the <code>write.xlsx2</code> function of <code>xlsx</code> R package. For instance, see the code below. </p>
  
  <pre><code>main_path&lt;-"~/mydir/"
  read.xlsx2(paste0(main_path,"my_input_excel.xlsx"), sheetIndex=1)
  a&lt;-1
  write.xlsx2(a, paste0(main_path,"my_output_excel.xlsx"), sheetName="Sheet1", col.names=TRUE, row.names=FALSE, append=FALSE)
  </code></pre>
  
  <p>While <code>read.xlsx2</code> function works fine, <code>write.xlsx2</code> function gives the error</p>
  
  <blockquote>
    <p>Error in <code>.jnew("java/io/FileOutputStream", jFile)</code> :<br>
    java.io.FileNotFoundException: /mydir/my_output_excel.xlsx (No such
    file or directory)</p>
  </blockquote>
  
  <p>When I remove the <code>paste0</code> part and write only the file name everything is fine again. So the problem is to define path. </p>
  
  <p>p.s I am wondering, perhaps the <code>write.xlsx</code> ignores the tilde <code>~</code> so path definition becomes garbage. </p>