Ali Raza
Ali Raza

Reputation: 63

"The package java.sql is not accessible." in eclipse

package test;

import java.sql.*;

public class Test2 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

    }

}

in the above code. import java.sql.*; contain error that is "The package java.sql is not accessible". Please help me to resolve this error. why java.sql is not accessible.

Upvotes: 6

Views: 20897

Answers (1)

seenukarthi
seenukarthi

Reputation: 8682

I can see the module-info.java file in your screenshot, which means you use Java 9 and above. Please add the following in the module-info.java if you want to use modules for your application

requires java.sql;

If you do not want to use modules, delete the module-info.java

Upvotes: 12

Related Questions