Hi folks, I'm using kotlin with intellij and gradl...
# announcements
j
Hi folks, I'm using kotlin with intellij and gradle, and have weird problem : I can access (build+run) java.io.InputStream.readAllBytes() in the IDE, but when running the project with gradle, i'm getting an "Unresolved reference: readAllBytes" readAllBytes seems included in Java12 but not in Java1.8 ... Any quick hint ? I can provide a sample project to reproduce that ...
u
InputStream.readAllBytes()
was added in java 9. Which java version are you using when running gradle?
c
j
@Uzi Landsmann In not sure on to specify in gradle to use Java12 ?
u
Gradle uses whatever is defined in your JAVA_HOME.
j
@Uzi Landsmann It makes sense. My environnement defaults to java-8-opensdk ... I'll tweak that and it should be ok.
👍 1
(confirmed : on archlinux, "sudo archlinux-java set java-12-openjdk" solved my problem. Thx !)
c
if you just use the kotlin method instead your code will also work with 1.8
j
@christophsturm Yes, but my code was about to read all bytes of a DigestInputStream to calculate some sha-256 hash.
(and not a File)
c
I think there’s also a method for input stream