NoClassDefFoundError:com.opencsv.CSVWriter [英] NoClassDefFoundError: com.opencsv.CSVWriter

查看:316
本文介绍了NoClassDefFoundError:com.opencsv.CSVWriter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用opencsv libray来获取加密格式的数据。但是,当写在CSV作者我得到NoClassDefFoundError。我已经看到许多相关的相同的错误,并尝试几乎每一个事情,但仍然无法纠正的问题。以下链接出现相同错误。




I am try to use opencsv libray to get encrypted format data. But while writing on CSV writer I am getting "NoClassDefFoundError". I have seen many post related with same error and tried also almost every thing, but still not able to rectify the problem. Below link with same error.

csv description1

csv description2

CSVHelper code:

public String stringify(List<? extends SerializeableToCSV> objects) 
        throws IllegalArgumentException {

    if (objects == null || objects.isEmpty()) 
        throw new IllegalArgumentException("List of objectes passed is either null or empty");

    List<String[]> strList = new ArrayList<String[]>();

    // add header record
    strList.add(objects.get(0).getColumnHeaders());

    Iterator<? extends SerializeableToCSV> it = objects.iterator();
    while (it.hasNext()) {
        SerializeableToCSV element = it.next();
        strList.add(element.getValueList());
    }

    StringWriter writer = new StringWriter();
    CSVWriter csvWriter = new CSVWriter(writer, CSVHelper.VALUE_SEPERATOR, CSVWriter.NO_QUOTE_CHARACTER);
    csvWriter.writeAll(strList);

    try {
        csvWriter.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return writer.toString();
}

All open csv library stuff in my libs folder.

Error LOG:

04-14 16:03:09.260: E/AndroidRuntime(13047): java.lang.NoClassDefFoundError: com.opencsv.CSVWriter
04-14 16:03:09.260: E/AndroidRuntime(13047):    at com.stellapps.encryption.CSVHelper.stringify(CSVHelper.java:62)
04-14 16:03:09.260: E/AndroidRuntime(13047):    at com.stellapps.encryption.Csv.createCSVString(Csv.java:62)
04-14 16:03:09.260: E/AndroidRuntime(13047):    at com.stellapps.encryption.Csv.generateCsvEncryptedFormat(Csv.java:111)

Please let me know if any other details required. Any help will be appreciated.

One more thing I want to add is, below error before getting the above exception.

Could not find class 'com.opencsv.bean.HeaderColumnNameTranslateMappingStrategy', referenced from method com.example.encryption.CSVHelper.parse

解决方案

The class for which it is giving error might be present in the class path but the jar which you require might have some dependencies.

Please find the link below to check the dependencies and add the dependent jars: http://opencsv.sourceforge.net/dependencies.html

这篇关于NoClassDefFoundError:com.opencsv.CSVWriter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆