title: How to open a file as read-only with java?
body: <p>I have a openFile method that gets a File that's stored in the object and opens it with the default program for that file extension.</p>
  
  <p>For example, if the file <code>Book.xls</code> is stored, <code>openFile</code> will launch excel in a windows desktop.</p>
  
  <pre><code>private void openFile() throws IOException {
  
          Desktop dt = Desktop.getDesktop();
          dt.open(shl.getCurrentTab().getFileDemo());
  }
  </code></pre>
  
  <p>What I want to know is the following: <em>how can I make the file that's stored <strong>read-only</strong>?</em> I don't want the original local file to be read-only as well, just when it's opened through through this method.</p>