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: 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…
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…
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 …
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.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…
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…
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…
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…
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: 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.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 …
Have a Java error that's not listed? Get an instant explanation.
Explain Another Error