0

I have this old project which was implemented a long time ago, and it uses sun.misc.BASE64Decoder and sun.misc.BASE64Encoder. When I imported the project into Eclipse it is showing me the that their imports cannot be resolved to a valid object.

I have tried using all the recommended methods on Stack overflow like turning errors into warnings. For references here's a screenshot

Thanks in advance for the help :)

  • 1
    That package removed in Java 9. If it is possible strongly recommended to change those classes to an other e.g. some of ```java.util.*``` or use an ancient Java. Here is a link to migration: https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-F7696E02-A1FB-4D5A-B1F2-89E7007D4096 – zforgo Mar 05 '23 at 20:52

2 Answers2

1

If you're using JDK 8+ then the reason is likely that the package for Base64Encoder and Base64Decoder has changed from sun.misc to java.util (see Is Java 8 java.util.Base64 a drop-in replacement for sun.misc.BASE64?)

You could either use an older JDK or replace the package.

Normally you don't have to expect the JDK packages to change - except for javax.* and sun.*. As far as I know these packages were originally for vendor specific or experimental classes and IIRC the Java docs explicitly mention that this could change - although this rarely happens.

0

Classes from the sun package are deprecated and have been removed in newer JDK versions. So your old project will likely not find them anymore.

You should migrate to the respective replacements from java.util.Base64.

Crusha K. Rool
  • 1,502
  • 15
  • 24