adding jar in Jcreator

假装没事ソ 提交于 2019-12-11 01:13:28

问题


I want to read doc file by writing java code in jcreator editor . For this purpose , I want to use Apache POI jar file .

But I don't know how to add jar file in Jcreator editor . My file structure is like this :

Now I am referring using this code .

import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.hpsf.DocumentSummaryInformation;
import org.apache.poi.hwpf.*;
import org.apache.poi.hwpf.extractor.*;
import org.apache.poi.hwpf.usermodel.HeaderStories;

But Jcreator is showing this error to me .

H:\Code For others\chat\docx file\ReadDocFileFromJava.java:1: package org.apache.poi.poifs.filesystem does not exist
import org.apache.poi.poifs.filesystem.*;
^
H:\Code For others\chat\docx file\ReadDocFileFromJava.java:2: package org.apache.poi.hpsf does not exist
import org.apache.poi.hpsf.DocumentSummaryInformation;
                          ^
H:\Code For others\chat\docx file\ReadDocFileFromJava.java:3: package org.apache.poi.hwpf does not exist
import org.apache.poi.hwpf.*;

Why is the Jcreator showing this errors ? What do I do to remove this error ? I am following thus tutorial for doc file reading .


回答1:


  1. Highlight the current project:

  2. Click on the properties button:

  3. Click on the Required Libraries tab, then click New:

  4. Give the library an appropriate name, then click Add -> Add Archive:

  5. Use the navigator to select the .jar file, then click OK on the Set Library window.

  6. Ensure the libraries are checked, then click OK:

After this, the project should build correctly.


Note

I couldn't locate the library with the exact name yours had, but when I went looking for them I had to download both POI Scratchpad and Apache POI in order to get it working, so pay close attention to exactly which packages aren't found if it still doesn't build when you follow the steps above



来源:https://stackoverflow.com/questions/25578876/adding-jar-in-jcreator

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!