title: dynamically create doc using java but not working
body: <p>I am Create doc using,</p>
  
  <pre><code>package testreport;
  import java.io.File;
  import java.io.FileOutputStream;
  import org.apache.poi.xwpf.usermodel.XWPFDocument;
  import org.apache.poi.xwpf.usermodel.XWPFParagraph;
  import org.apache.poi.xwpf.usermodel.XWPFRun;
  
  public class creatrepo {
  
      public static void createDocFile(String fileName) {
  
          try {
              File file = new File(fileName);
              FileOutputStream fos = new FileOutputStream(file.getAbsolutePath());
  
              XWPFDocument doc = new XWPFDocument();
              XWPFParagraph tempParagraph = doc.createParagraph();
              XWPFRun tempRun = tempParagraph.createRun();
  
              tempRun.setText("Wel come");
              tempRun.setFontSize(12);
              doc.write(fos);
              fos.close();
  
              System.out.println(file.getAbsolutePath()+ " created successfully!");
  
          } catch (Exception e) {
  
          }
  
      }
  
      public static void main(String[] args) {
  
          createDocFile("/home/DocxFile.docx");
  
  
      }
  
  }
  </code></pre>
  
  <p>I added jar file <code>'poi-3.14.jar'</code> when run my code i getting error:</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.NoClassDefFoundError: org/openxmlformats/schemas/wordprocessingml/x2006/main/CTDocument1$Factory
        at org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentCreate(XWPFDocument.java:282)
        at org.apache.poi.xwpf.usermodel.XWPFDocument.(XWPFDocument.java:136)
        at testreport.creatrepo.createDocFile(creatrepo.java:16)
        at testreport.creatrepo.main(creatrepo.java:36)
    Caused by: java.lang.ClassNotFoundException: org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocument1$Factory
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 4 more</p>
  </blockquote>
  
  <p>help me</p>