title: How to get the Slide number using java via Apache POI API
body: <p>How do I  get the number of slides in a <code>.ppt</code> file using java. To access the <code>.ppt</code> we require the Apache POI API - especially the <code>Slide[]</code> class.</p>
  
  <p>I'm using the method <code>getSlideNumber()</code> from <a href="http://poi.apache.org/apidocs/org/apache/poi/hslf/model/Slide.html" rel="nofollow">here</a> to retrieve the page number but I'm still getting an error. I would like to know how to get the slide numbers.</p>
  
  <pre><code>public final class count {
  
    public static void main(String args[]) throws Exception {
  
      File file= new File("C:/Users/THIYAGARAJAN/Desktop/ppt52.ppt");
      FileInputStream is = new FileInputStream(file);
      SlideShow ppt = new SlideShow(is);
      is.close();
      Slide[] slide = ppt.getSlides();
      System.out.println(slide.length);
      for (int i = 0; i &lt; slide.length; i++)  {
        String title = slide[i].getTitle();
        System.out.println("Rendering slide "
                           + slide[i].getSlideNumber()
                           + (title == null ? "" : ": " + title));
      }
    }
  
  }
  </code></pre>
  
  <p>Is this code correct? </p>
  
  <p>Edit: Here's the error I get in my console:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchFieldError: filesystem 
  at org.apache.poi.hslf.HSLFSlideShow.getPOIFSFileSystem(HSLFSlideShow.java:79) 
  at org.apache.poi.hslf.EncryptedSlideShow.checkIfEncrypted(EncryptedSlideShow.java:‌​51)
  at org.apache.poi.hslf.HSLFSlideShow.&lt;init&gt;(HSLFSlideShow.java:141)
  at org.apache.poi.hslf.HSLFSlideShow.&lt;init&gt;(HSLFSlideShow.java:115) 
  at org.apache.poi.hslf.HSLFSlideShow.&lt;init&gt;(HSLFSlideShow.java:103)
  at org.apache.poi.hslf.usermodel.SlideShow.&lt;init&gt;(SlideShow.java:121) 
  at count.count.main(count.java:22) 
  </code></pre>