Java91 errors documented

Common Java Errors and How to Fix Them

Browse all documented Java errors with detailed explanations, root causes, and step-by-step fixes.

Cannot find symbol: class Scanner on line 5

This error occurs when Java cannot find a class, method, or variable that is being used in the code. It is often caused

Java
Guide

java: cannot find symbol symbol: class Scanner location: class Main

This error occurs when the Java compiler cannot find a class, method, or variable that is used in the code. In this case

Java
Guide

ORA-12545: TNS:Cannot register with TSLS (TNS Listener Service)

This error occurs when the Oracle JDBC driver is unable to establish a connection with the TNS Listener Service due to a

Java
Guide

Cannot get JDBC connection; nested exception is com.mysql.cj.jdbc.exceptions.Com

This error occurs when the Java application is unable to establish a connection to the database. It usually happens due

Java
Guide

Error executing SQL query: Cannot insert explicit value for identity column in t

This error occurs when you're trying to insert a value into an auto-incrementing primary key column in a database, but t

Java
Guide

java.util.ConcurrentModificationException: Cannot modify a Collection while it i

This error occurs when a program attempts to modify a collection (like a list or set) while it is being iterated over by

Java
Guide

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating

This error occurs when Spring cannot find or autowire a required bean, often due to a missing or incorrect dependency co

Java
Guide

Incompatible types: int cannot be converted to String

This error occurs when you are trying to assign a value of one data type to a variable that is declared with a different

Java
Guide

Parameter index out of range: 2, query was: SELECT * FROM users WHERE username =

This error occurs when the number of parameters in a SQL query does not match the number of placeholders (represented by

Java
Guide

Syntax error on token 'int', delete this token

This error occurs when the compiler encounters unexpected syntax in the code, making it difficult to parse and compile.

Java
Guide

java: cannot find symbol variable 'user' in method 'main' at line 10

This error occurs when the compiler cannot find the definition of a variable, method, or class that is being used in the

Java
Guide

java.lang.StackOverflowError at com.example.Main.main(Main.java:15) - unable to

This error occurs when a method calls itself recursively without a proper base case, leading to excessive recursion and

Java
Guide

Have a Java error that's not listed? Get an instant explanation.

Explain Another Error