Skip to content
  1. LuzineDebug
  2. Java, Kotlin & .NET

Java, Kotlin & .NET errors: causes and fixes

Java, Kotlin, Gradle, Maven, Spring Boot and C#/.NET errors: NullPointerException, unsupported class version, missing dependencies, port already in use. The exact commands to fix them.

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.length()"…

Fix "java.lang.NullPointerException: Cannot invoke … because … is null" in Java

You call a method or read a field on a reference that is null. Since Java 14, the message tells you exactly which expression was n…

Beginner 10 min
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/example/App has bee…

Fix "UnsupportedClassVersionError: compiled by a more recent version of the Java Runtime"

The code was compiled for a newer Java version than the one running it (here class 65 = Java 21, JVM 61 = Java 17). Run it with a…

Intermediate 10 min
FAILURE: Build failed with an exception.

Fix "Could not resolve all files for configuration" and "Could not find" in Gradle

Gradle could not find a dependency in any of the declared repositories. Check that the group:name:version coordinates really exist…

Intermediate 15 min
***************************

Fix "Web server failed to start. Port 8080 was already in use" in Spring Boot

Another program is already listening on port 8080, often a previous instance of your application still running in the IDE. Find it…

Beginner 5 min
***************************

Fix "Failed to configure a DataSource: 'url' attribute is not specified" in Spring Boot

Spring Boot sees a database starter (JPA or JDBC) but finds neither spring.datasource.url nor an embedded database. Add your datab…

Beginner 10 min
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Fix "java.lang.OutOfMemoryError: Java heap space" (and GC overhead limit exceeded)

The JVM has no room left in its heap to create an object. If the need is legitimate, raise the maximum size with -Xmx (or org.grad…

Advanced 30 min
System.NullReferenceException: Object reference not set to an instance of an object.

Fix "Object reference not set to an instance of an object" (NullReferenceException) in C#

You use a member (method, property, indexer) of a variable that is null. Find the line shown in the stack trace, identify which re…

Beginner 10 min
kotlin.UninitializedPropertyAccessException: lateinit property binding has not been initia…

Fix "lateinit property binding has not been initialized" in Kotlin (Android)

You read a lateinit property before giving it a value. With ViewBinding, assign binding in onCreate() (Activity) or onCreateView()…

Beginner 10 min

Other areas