I'm trying to migrate an application from Java 8 to Java 11. When I try and build the project in IntelliJ I get a package sun.util does not exist
error?
Any ideas on what's up?
Thanks!
Packages com.sun.*
and sun.*
hold internal stuff, and should not be used by thirdparty applications (like yours probably) in general case.
Since in java 9 the module system has been introduced, now Oracle "protect" these packages even in compile time.
So the obvious way is to get rid of this dependency in your code. Why do they protect? Because they leave the right to themselves to change this stuff, its considered internal as I said.
Addition:
You can try (I do not recommend) to apply some "resolution" tools found in this great article (Read "Illegal Access To Internal APIs" chapter), but as the author of this article states, the most straightforward way is to stop using these packages in your code, so consider it as the first bet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With