close

[Solved] Exception in thread “main” java.lang.AssertionError

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Exception in thread “main” java.lang.AssertionError in java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Exception in thread “main” java.lang.AssertionError Error Occurs?

Today I get the following error Exception in thread “main” java.lang.AssertionError in java.

How To Solve Exception in thread “main” java.lang.AssertionError Error ?

  1. How To Solve Exception in thread “main” java.lang.AssertionError Error ?

    To Solve Exception in thread “main” java.lang.AssertionError Error Solution: look for compilation errors. Sometimes your IDE may be able to find them for you, without raising this error.

  2. Exception in thread “main” java.lang.AssertionError

    To Solve Exception in thread “main” java.lang.AssertionError Error Solution: look for compilation errors. Sometimes your IDE may be able to find them for you, without raising this error.

Solution 1

I had the same issue. Forcing maven-compiler-plugin to use javac helped me discover actual compilation errors.

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <forceJavacCompilerUse>true</forceJavacCompilerUse>
  </configuration>
</plugin>

Solution 2

I ran into this very unhelpful error while compiling a project, and discovered that the problem was a reference to a non-existent static inner class inside another class (it had been renamed). Once that was resolved, the error went away.

Solution: look for compilation errors. Sometimes your IDE may be able to find them for you, without raising this error.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment