Home > Software engineering >  mvn clean install ERROR: cannot find symbol symbol: class BASE64Encoder, location: package sun.misc
mvn clean install ERROR: cannot find symbol symbol: class BASE64Encoder, location: package sun.misc

Time:08-24

I'm trying to setup a legacy java application so I can reverse engineer it. However, when building it via mvn clean install from the mac terminal (I've tried Rossetta and normal), I get this error:

[ERROR] /Users/danieljohnson/Documents/manage/og/gems/ems/src/main/java/com/ems/hvac/utils/CryptographyUtil.java:[34,16] cannot find symbol
  symbol:   class BASE64Decoder
  location: package sun.misc
[ERROR] /Users/danieljohnson/Documents/manage/og/gems/ems/src/main/java/com/ems/hvac/utils/CryptographyUtil.java:[35,16] cannot find symbol
  symbol:   class BASE64Encoder
  location: package sun.misc
[INFO] 2 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.631 s
[INFO] Finished at: 2022-08-23T12:43:34-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project ems: Compilation failure: Compilation failure: 
[ERROR] /Users/danieljohnson/Documents/manage/og/gems/ems/src/main/java/com/ems/hvac/utils/CryptographyUtil.java:[34,16] cannot find symbol
[ERROR]   symbol:   class BASE64Decoder
[ERROR]   location: package sun.misc
[ERROR] /Users/danieljohnson/Documents/manage/og/gems/ems/src/main/java/com/ems/hvac/utils/CryptographyUtil.java:[35,16] cannot find symbol
[ERROR]   symbol:   class BASE64Encoder
[ERROR]   location: package sun.misc
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project ems: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:375)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)

output of java -version:

openjdk version "1.8.0_345"
OpenJDK Runtime Environment (Zulu 8.64.0.19-CA-macos-aarch64) (build 1.8.0_345-b01)
OpenJDK 64-Bit Server VM (Zulu 8.64.0.19-CA-macos-aarch64) (build 25.345-b01, mixed mode)

I'm aware the sun.misc package is deprecated and should be replaced by java.util.Base64. However, that's not a plug and play solution, so I would like to get it working with sun.misc if possible.

CodePudding user response:

If you dont' see sun.misc then you will unfortunately need to make minor code changes to use the new library

CodePudding user response:

You should change the code to use java.util.Base64 instead. It is time to pay the technical debt.

  • Related