title: I am using pdfbox-app-2.0.0-RC3 but still I am getting Error while using RndomAccessFile in PDF parser
body: <p>-You can see the example via this link:
  <a href="http://radixcode.com/pdfbox-example-code-how-to-extract-text-from-pdf-file-with-java/" rel="nofollow noreferrer">http://radixcode.com/pdfbox-example-code-how-to-extract-text-from-pdf-file-with-java/</a></p>
  
  <pre><code>import java.io.IOException;
  
  public class JavaPDFTest {
  
      public static void main(String[] args) throws IOException {
  
         PDFManager pdfManager = new PDFManager();
         pdfManger.setFilePath("E:\test.pdf");
         System.out.println(pdfManager.ToText());       
      }    
  }
  </code></pre>
  
  <p></p>
  
  <pre><code>import java.io.File;
  import java.io.IOException;
  import org.apache.pdfbox.cos.COSDocument;
  import org.apache.pdfbox.io.RandomAccessFile;
  import org.apache.pdfbox.pdfparser.PDFParser;
  import org.apache.pdfbox.pdmodel.PDDocument;
  import org.apache.pdfbox.text.PDFTextStripper;
  
  public class PDFManager {
  
     private PDFParser parser;
     private PDFTextStripper pdfStripper;
     private PDDocument pdDoc ;
     private COSDocument cosDoc ;
  
     private String Text ;
     private String filePath;
     private File file;
  
      public PDFManager() {
  
      }
     public String ToText() throws IOException
     {
         this.pdfStripper = null;
         this.pdDoc = null;
         this.cosDoc = null;
  
         file = new File(filePath);
         parser = new PDFParser(new RandomAccessFile(file,"r")); // update for PDFBox V 2.0
  
         parser.parse();
         cosDoc = parser.getDocument();
         pdfStripper = new PDFTextStripper();
         pdDoc = new PDDocument(cosDoc);
         pdDoc.getNumberOfPages();
         pdfStripper.setStartPage(1);
         pdfStripper.setEndPage(10);
  
         // reading text from page 1 to 10
         // if you want to get text from full pdf file use this code
         // pdfStripper.setEndPage(pdDoc.getNumberOfPages());
  
         Text = pdfStripper.getText(pdDoc);
         return Text;
     }
  
      public void setFilePath(String filePath) {
          this.filePath = filePath;
      }
  }
  </code></pre>
  
  <p>The Error</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.ClassCastException: java.io.RandomAccessFile cannot be cast to org.apache.pdfbox.io.RandomAccessRead<br>
        at aechaec.PDFManager.ToText(PDFManager.java:43)<br>
        at aechaec.AechAEC.main(AechAEC.java:25)<br>
    Java Result: 1</p>
  </blockquote>
  
  <p>is it caused by security privileges ? because I'm using Netbeans on mac?</p>