phauer / svg-buddy

Command line tool to embed fonts into SVG files
MIT License
45 stars 2 forks source link

Compilation error #3

Open kincsescsaba opened 3 years ago

kincsescsaba commented 3 years ago

Hi, I get the following compilation error when running the build: Compilation failure: [ERROR] /home/kincsescsaba/IdeaProjects/svg-embedder/svg-buddy/src/main/kotlin/com/phauer/svgbuddy/SvgFontEmbedder.kt:[37,36] Unresolved reference: readString [ERROR] /home/kincsescsaba/IdeaProjects/svg-embedder/svg-buddy/src/main/kotlin/com/phauer/svgbuddy/SvgFontEmbedder.kt:[91,15] Unresolved reference: writeString [ERROR] /home/kincsescsaba/IdeaProjects/svg-embedder/svg-buddy/src/main/kotlin/com/phauer/svgbuddy/processing/CliParser.kt:[36,25] Unresolved reference: of [ERROR] /home/kincsescsaba/IdeaProjects/svg-embedder/svg-buddy/src/main/kotlin/com/phauer/svgbuddy/processing/GoogleFontsClient.kt:[40,60] Unresolved reference: readAllBytes

Can you please check how to resolve this?

Leif-W commented 3 years ago

TL;DR What version on Java is in use? I am guessing Java 8. You need Java 11.

There're 4 errors. Let's take a look at each.

For the first two errors, they seem related. A quick look at the source for SvgFontEmbedder.kt shows that Files.readString and Files.writeString are used. Files is imported from java.nio.file.Files. This API did not have .readString or .writeString methods until Java 11.

The third error in CliParser.kt, is also related. Searching for the next error, Path.of where Path is imported from the similarly named java.nio.file.Path, where the .of method was likewise introduced in Java 11.

The fourth error in GoogleFontsClient.kt comes from the use of ZipFile which is imported from net.lingala.zip4j.Zipfile which calls the method .getInputStream which returns a ZipInputStream which extends an InputStream that is imported from java.io.InputStream which has the .readAllBytes method, introduced in Java 9.

Therefore, you must be using Java 8, where Java 11 is required.

kincsescsaba commented 3 years ago

You're right, Java 11 was only set in my IDE but not on the overall system. Got it set to the newer version, now works fine, thanks!