Reputation: 306
I tried to compile a java file using CMD but I got error of these. I have follow other solutions on stackoverflow but still not solved.
C:\Users\User\eclipse-workspace\Calendar_v1\src\cal>javac ShiftSetting.java
ShiftSetting.java:7: error: package org.apache.poi.ss.usermodel does not exist
import org.apache.poi.ss.usermodel.Cell;
^
ShiftSetting.java:8: error: package org.apache.poi.ss.usermodel does not exist
import org.apache.poi.ss.usermodel.DataFormatter;
^
ShiftSetting.java:9: error: package org.apache.poi.ss.usermodel does not exist
import org.apache.poi.ss.usermodel.Row;
^
ShiftSetting.java:10: error: package org.apache.poi.xssf.usermodel does not exist
import org.apache.poi.xssf.usermodel.XSSFSheet;
^
ShiftSetting.java:11: error: package org.apache.poi.xssf.usermodel does not exist
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
^
ShiftSetting.java:21: error: cannot find symbol
XSSFWorkbook wb = new XSSFWorkbook(file);
^
symbol: class XSSFWorkbook
location: class ShiftSetting
ShiftSetting.java:21: error: cannot find symbol
XSSFWorkbook wb = new XSSFWorkbook(file);
^
symbol: class XSSFWorkbook
location: class ShiftSetting
ShiftSetting.java:22: error: cannot find symbol
XSSFSheet sheet = wb.getSheetAt(0);
^
symbol: class XSSFSheet
location: class ShiftSetting
ShiftSetting.java:24: error: cannot find symbol
DataFormatter formatter = new DataFormatter();
^
symbol: class DataFormatter
location: class ShiftSetting
ShiftSetting.java:24: error: cannot find symbol
DataFormatter formatter = new DataFormatter();
^
symbol: class DataFormatter
location: class ShiftSetting
ShiftSetting.java:29: error: cannot find symbol
Row r = sheet.getRow(rowNum);
^
symbol: class Row
location: class ShiftSetting
ShiftSetting.java:32: error: cannot find symbol
Cell cell = r.getCell(m);
^
symbol: class Cell
location: class ShiftSetting
ShiftSetting.java:39: error: cannot find symbol
Row r = sheet.getRow(rowNum);
^
symbol: class Row
location: class ShiftSetting
ShiftSetting.java:43: error: cannot find symbol
Cell cell = r.getCell(m);
^
symbol: class Cell
location: class ShiftSetting
14 errors
here is the ShiftSetting.java file that I'm trying to compile
package cal;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class ShiftSetting {
public static void main(String[] args) {
// code
}
}
I have import all the APACHE-POI jar files into my java build path
I have added those path to user environment variable too like this
Can anyone tell me which way should I try now? because I don't have any idea what to do anymore.
Upvotes: 1
Views: 14057
Reputation: 306
My problem was the classpath. After several attempts of trying I now can compile all the 8 jar files in a single line like this:
C:\Users\User\eclipse-workspace\Calendar_v1\src\cal>javac -cp jars/dom4j-1.6.1.jar;jars/poi-3.2-final.jar;jars/poi-3.7.jar;jars/poi-examples-3.7.jar;jars/poi-ooxml-3.7.jar;jars/poi-ooxml-schemas-3.7.jar;jars/poi-scratchpad-3.7.jar;jars/xmlbeans-2.3.0.jar ShiftSetting.java
Problem solved ( btw this is for window )
Upvotes: 3