AHUGEFATTY 2017-09-17 07:49
浏览 1322

excell存盘错误找不到TreeBidiMap

NoClassDefFoundError: org/apache/commons/collections4/bidimap/TreeBidiMap

目前我报错的版本:
hamcrest-core-1.3
junit-4.12
ooxml-schemas-1.1.jar(网上说下载解决依赖,引入项目还是报错,项目确实没有这个类)
poi-3.17.jar
jdk1.8.0_131(jdk应该没关系)

problem中的报错:
The project was not built since its build path is incomplete. Cannot find the class file for org.apache.tools.ant.taskdefs.Typedef. Fix the build path then try building this project

junit中的报错:
java.lang.NoClassDefFoundError: org/apache/commons/collections4/bidimap/TreeBidiMap
at org.apache.poi.hpsf.Section.(Section.java:178)
at org.apache.poi.hpsf.MutableSection.(MutableSection.java:41)
at org.apache.poi.hpsf.PropertySet.init(PropertySet.java:494)
at org.apache.poi.hpsf.PropertySet.(PropertySet.java:196)
at org.apache.poi.hpsf.MutablePropertySet.(MutablePropertySet.java:44)
at org.apache.poi.hpsf.SpecialPropertySet.(SpecialPropertySet.java:47)
at org.apache.poi.hpsf.DocumentSummaryInformation.(DocumentSummaryInformation.java:99)
at org.apache.poi.hpsf.PropertySetFactory.create(PropertySetFactory.java:116)
at org.apache.poi.POIDocument.getPropertySet(POIDocument.java:236)

 package TestCase;


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Date;
import java.util.List;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFName;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.WebDriver;

/**
 * MainRemark TODO
 * Modual TODO
 * @author ***
 * TestCaseTestExcellMaker.java
 * 上午11:13:36
 * 
 */
public class TestExcellMaker {

    @Before
    public void setUp() throws Exception {
        System.out.println("make excell file testcase");
    }

    @After
    public void tearDown() throws Exception {

    }

    WebDriver driver;

    @Test
    public void test() throws IOException {
    // ------
    // 创建HSSFWorkbook对象
        try {
            HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream("***.xls"));
            HSSFSheet sheet = wb.getSheet("Sheet1");//得到表一
            HSSFRow row = sheet.getRow(7);          //得到表一 行7  下标为0
            HSSFCell cell = row.getCell(2);         //得到表一 列7  下标为0
            System.out.println(cell.getStringCellValue());//输出C8的值
            cell.setCellValue("");                  //清空    
            System.out.println(cell.getStringCellValue());
            cell.setCellValue("SeleN"+(new Date()).getTime()+"");  //程序设置成功
            System.out.println(cell.getStringCellValue());   //HPBCSele5958
            // 输出Excel文件

            FileOutputStream output = new FileOutputStream("***.xls");
            wb.write(output);
            output.close();
//          wb.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }


    @Ignore
    @Test
    public void printXlsCoulums() throws FileNotFoundException, IOException{
        HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream("***.xls"));
        List<HSSFName> allNames = wb.getAllNames();
        HSSFSheet sheet = wb.getSheet("Sheet1");
        for(int rowPositon=0;rowPositon<sheet.getPhysicalNumberOfRows();rowPositon++){
            int cellTotal=sheet.getRow(rowPositon).getPhysicalNumberOfCells();
            for(int cell=0;cell<cellTotal;cell++){
                HSSFCell target = sheet.getRow(rowPositon).getCell(cell);
                if(target != null){
                System.out.println("Row:"+rowPositon+" / cell:"+cell+"  "+target);
            }
            }
        }
    }


}

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 运筹学排序问题中的在线排序
    • ¥15 关于#flink#的问题:关于docker部署flink集成hadoop的yarn,请教个问题flink启动yarn-session.sh连不上hadoop
    • ¥30 求一段fortran代码用IVF编译运行的结果
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 lammps拉伸应力应变曲线分析
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题