NoClassDefFoundError: org/apache/commons/lang3/StringUtils

后端 未结 6 1669
孤独总比滥情好
孤独总比滥情好 2020-12-01 10:54

I\'m trying to run the sample project with this library and I get the following error:

Exception in thread \"main\" java.lang.NoClassDefFoundError: 

    org         


        
相关标签:
6条回答
  • 2020-12-01 11:02

    I was having this issue in IJ version 2016 after updating it to 2018.3.4 and clicking "Generate sources and update folders for all projects" at Maven options tab the issue went away

    0 讨论(0)
  • 2020-12-01 11:03

    When everything else is correct, rarely jar file gets corrupted. Ensure you don't see error something like below while compiling

    [ERROR] error reading 
    C:\Users\Mohan\.m2\repository\org\apache\commons\commons-lang3\3.7\commons-lang3-3.7.jar; 
    ZipFile invalid LOC header (bad signature)
    
    0 讨论(0)
  • 2020-12-01 11:07

    If you're using Maven, put this inside your pom.xml file:

    Maven Central Repository for Commons Lang:

    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    

    Maven Central Repository for Apache Commons Lang:

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.11</version>
    </dependency>
    

    Don't forget: Update Maven Project


    Apache Commons Lang ™ Dependency Information

    Last Published: 30 August 2020 | Version: 3.11

    Apache Maven

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.11</version>
    </dependency>
    

    Apache Buildr

    'org.apache.commons:commons-lang3:jar:3.11'
    

    Apache Ivy

    <dependency org="org.apache.commons" name="commons-lang3" rev="3.11">
      <artifact name="commons-lang3" type="jar" />
    </dependency>
    

    Groovy Grape

    @Grapes(
    @Grab(group='org.apache.commons', module='commons-lang3', version='3.11')
    )
    

    Gradle/Grails

    compile 'org.apache.commons:commons-lang3:3.11'
    

    Scala SBT

    libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.11"
    

    Leiningen

    [org.apache.commons/commons-lang3 "3.11"]
    

    Reference:

    • https://commons.apache.org/proper/commons-lang/dependency-info.html
    0 讨论(0)
  • 2020-12-01 11:07

    Adding below worked for me

       <dependency>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-math3</artifactId>
                    <version>3.6.1</version>
         </dependency>
    
    0 讨论(0)
  • 2020-12-01 11:12

    Yo adding the below and update maven pronject worked like a charm

    <dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.1</version>
    

    0 讨论(0)
  • 2020-12-01 11:19

    I have added commons-lang-2.6.jar & commons-lang3-3.1-sources.jar...

    Here's your problem: commons-lang-2.6.jar doesn't contain the org.apache.commons.lang3 package, since that's part of version 3, and commons-lang3-3.1-sources.jar contains the source code, not the byte code.

    You need to include commons-lang3-3.1.jar instead.

    0 讨论(0)
提交回复
热议问题