Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ says the package does not exist, But I can access the package

I get the error below, but I can find the package in rt.jar. I can see the JDK being used from Project Structure. I'm not sure what's missing.

Error:(6, -1) Play 2 Compiler: 
 C:\user\projects\portal\app\com\example\security\cert\X509Cert.java:6: package sun.security.pkcs10 does not exist
 import sun.security.pkcs10.*;
 C:\user\projects\portal\app\com\v\security\cert\GenerateCSR.java:75: cannot find symbol
like image 556
Spiff Avatar asked Nov 06 '16 10:11

Spiff


2 Answers

I had similar issue with different package: package sun.security.x509 does not exist

I used java 11 to compile the project.

In my case I had to disable Use '--release' option for cross-compilation in Java Compiler settings.enter image description here

like image 58
Kacper Cichecki Avatar answered Oct 17 '22 09:10

Kacper Cichecki


Your project SDK version under file>project structure>Project>Project SDK must be the same with your java compiler project bytecode version under file>Build, Execution, Deployment>Compiler>Java Compiler> look for "project bytecode version" right under your checkbox for "use '--release....'"

1.Project SDK version: enter image description here

2.Project Bytecode version enter image description here

like image 44
Tinyiko Chauke Avatar answered Oct 17 '22 08:10

Tinyiko Chauke