java.lang.ClassNotFoundException: org.apache.commons.collections4.ListValuedMap

17,882

You need a more recent version of commons-collections4. If you look at the Javadocs for ListValuedMap, you'll see that it was introduced in version 4.1, and you have 4.0 on your classpath.

You should consider using Maven or another dependency management tool as it will save you a lot of headaches.

Share:
17,882
NewbieDK
Author by

NewbieDK

Updated on December 02, 2022

Comments

  • NewbieDK
    NewbieDK over 1 year

    Trying to create a class that writes to an Excel file.

    Error(https://gyazo.com/8d8977786add756057bb1d32866942df): java.lang.ClassNotFoundException: org.apache.commons.collections4.ListValuedMap

    Libaries I have added (https://gyazo.com/cfa1555bd58de436bc243f1067b9e08b): poi-3.16.jar, poi-ooxml-3.16.jar, poi-ooxml-schemas-3.16.jar, commons-collections4-4.0.jar, xmlbeans-2.3.0.jar

    public void Create(){
        XSSFWorkbook workbook = new XSSFWorkbook();
        XSSFSheet sheet = workbook.createSheet(("Results"));
    
    
    
        try {
            FileOutputStream stream= new FileOutputStream(filelocation);
            workbook.write(stream);
            workbook.close();
        } 
        catch (FileNotFoundException e) {
            e.printStackTrace();
        } 
        catch (IOException e) {
            e.printStackTrace();
        }
    }
    

    }

    • Benji Weiss
      Benji Weiss almost 7 years
      did you include the necessary import statements for the libraries/packages you are using or did you just not include them in this post?
    • NewbieDK
      NewbieDK almost 7 years
      i added the imports just not in the post.