0

Yesterday I had my application from netbeans imported into eclipse but I've got an error with my connection to the database.

import com.sun.crypto.provider.RSACipher; 

It says:

Access restriction: The type RSACipher is not accessible due to restriction on required library

This import was working well in netbeans before but I cant get it solve on eclipse, can anyone help me?

Jav_Rock
  • 21,667
  • 19
  • 119
  • 164

3 Answers3

5

You are missing a JAR (sunjce_provider.jar) in classpath. Surely it comes with Netbeans but Eclipse has no idea about it hehe

http://www.jarfinder.com/index.php/java/info/com.sun.crypto.provider.SunJCE

Alfabravo
  • 7,354
  • 6
  • 45
  • 79
0

Cause of that is missing library in your project class path.

To fix it you must add proper jar reference to project class path.

0

The issue is with Eclipse, solutions have been covered in answers of this question:

Access restriction on class due to restriction on required library rt.jar?

The underlying reason (from my research on the subject) is that sun.* and com.sun.* packages are specific to Sun's JVM and could be changed in future release, and would not be present in other JVMs. For that reason they should not be used.

Community
  • 1
  • 1
Alex
  • 9,662
  • 8
  • 39
  • 60