0

Here is my code:

import org.apache.poi.hslf.HSLFSlideShow;

import org.apache.poi.hslf.model.Slide;

import org.apache.poi.hslf.usermodel.SlideShow;  
import java.io.*;  


public class CreateNewPresentation  
{  
    public static void main(args[])  
    {  
        try  
        {  
            SlideShow slideShow = new SlideShow();  
            Slide slide = slideShow.createSlide();  
            FileOutputStream out = new  
                FileOutputStream("slideshow.ppt");  
            slideShow.write(out);  
            System.out.println("File Created...");  
            out.close();  
        }  
        catch(Exception e)  
        {  
            e.printStackTrace();  
        }  
    }  
}  

The issue is that it does not recognise org.apache.poi package.

How can I make it work?

f_puras
  • 2,521
  • 4
  • 33
  • 38
  • 1
    where did you place your apache poi jar diles? What IDE are you using? – Hirak Mar 12 '14 at 06:58
  • My jar files are here :- C:\Users\sony\.groovy\grapes\org.apache.poi\poi\jars . And I am running my script on cmd. – Shekhar Raj Mar 12 '14 at 09:26
  • 1
    then you need to add -cp in your commandline argument else it will not find the required classes. – Hirak Mar 12 '14 at 09:29
  • How can I do this in netbeans? and can you add the snapshot of cmd? – Shekhar Raj Mar 12 '14 at 09:53
  • Sir, my jar file is here C:\Users\sony\.groovy\jars/poijar.jar . Now what command i have to enter exactly in cmd? can you please type here . My netbeans is showing some dependency error. – Shekhar Raj Mar 12 '14 at 10:21

1 Answers1

0

If you are using netbeans, refer this for setting classpath. If you want to set classpath from command line refer this

Community
  • 1
  • 1
Hirak
  • 3,601
  • 1
  • 22
  • 33
  • Sir, my jar file is here C:\Users\sony\.groovy\jars/poijar.jar . Now what command i have to enter exactly in cmd? can you please type here . My netbeans is showing some dependency error. – Shekhar Raj Mar 12 '14 at 10:23
  • Try java -cp C:\Users\sony\.groovy\jars/*" my.package.MainClass – Hirak Mar 12 '14 at 10:35