Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting noclassfoundexception : java.sql.SQLException in intellij idea for jdk 11

I am using latest version of Intellij Idea and set jdk as 11. When I execute my project it throws exception noclassfoundexception : java.sql.SQLException.

In java compiler settings in Intellij I have mentioned project bytecode version as 11. In project structure settings too, I have set the module jdk as 11.

like image 649
user3592376 Avatar asked Oct 25 '18 05:10

user3592376


People also ask

What is Java SQL SQLException?

An exception that provides information on a database access error or other errors. Each SQLException provides several kinds of information: a string describing the error. This is used as the Java Exception message, available via the method getMesasge .

Does IntelliJ use JDK or JRE?

Java Development Kit (JDK) To develop applications in IntelliJ IDEA, you need a Java SDK (JDK). A JDK is a software package that contains libraries, tools for developing and testing Java applications (development tools), and tools for running applications on the Java platform (Java Runtime Environment — JRE).


1 Answers

Try to change command line shortening method to "JAR manifest".

JAR manifest setting for unit test

I had exactly the same issue after upgrading my project from Java 8 to Java 11. It looks like it is IntelliJ IDEA bug.

Hint for solution taken from here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000022399-Error-running-a-cucumber-test-case-Caused-by-java-lang-NoClassDefFoundError-java-sql-Time

like image 112
Kostiantyn Avatar answered Sep 19 '22 16:09

Kostiantyn