Java errors
- Could not resolve all dependencies for configurationGradle could not download or locate one or more dependencies for a configuration. The artifact or version does not exist in the declared repositories, the repository is missing, or the network/proxy/auth blocks access.
- Error: Could not find or load main classThe JVM couldn't find the class you asked it to run on the classpath. Usually you ran it from the wrong directory, used the file name instead of the fully qualified class name, or forgot the package folder.
- ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.Gradle, Maven or another tool can't find a Java installation. Install a JDK and set JAVA_HOME to its folder.
- java.lang.ClassNotFoundException: com.mysql.cj.jdbc.DriverThe MySQL JDBC driver (Connector/J) isn't on the runtime classpath. It's missing from your build file, has the wrong scope, isn't packaged in the JAR/WAR, or isn't in the app server's lib folder.
- java.lang.NoClassDefFoundErrorA class that was present when your code was compiled can't be loaded at runtime. Either the JAR containing it is missing from the runtime classpath, or the class exists but its static initializer failed earlier.
- java.lang.NullPointerException: Cannot invoke "String.length()" because "<local1>" is nullCode dereferenced a reference that is null — called a method, read a field, indexed an array, unboxed a number or synchronized on it. Since Java 14, the message names exactly which expression was null.
- java.lang.OutOfMemoryError: Java heap spaceThe JVM couldn't allocate an object because the heap is full even after garbage collection. Either the max heap (-Xmx) is too small for the workload, or the program holds on to too much data (a leak or loading everything into memory).
- java.lang.UnsupportedClassVersionError: has been compiled by a more recent version of the Java RuntimeThe code was compiled for a newer Java than the one running it. Run it with a newer JDK, or compile for the older version with --release.
- java.util.ConcurrentModificationExceptionA collection was structurally modified (add/remove) while it was being iterated, so the iterator detected the change and failed fast. It happens in single-threaded code too — usually a remove() inside a for-each loop.
- The operation couldn't be completed. Unable to locate a Java Runtime.On macOS, `/usr/bin/java` is only a stub that looks for a JDK in /Library/Java/JavaVirtualMachines. This message means none is registered there, e.g. Java is not installed or was installed by Homebrew without the symlink.
- Web server failed to start. Port 8080 was already in use.Spring Boot's embedded Tomcat (or Jetty/Undertow) couldn't bind to port 8080 because another process is already listening there — often a previous run of the same app that never stopped.