1

I'm using Graal SDK in order to "translate" an R script to Java code.

The line is compiled and behaves well when the application runs:

Source.newBuilder("R", new File(config.defaultScriptPath)).build()

However, once a unit test that executes this line runs, I get an error:

java.lang.IllegalStateException: No language and polyglot implementation was found on the classpath. Make sure the truffle-api.jar is on the classpath.

Does anyone know how I can resolve this error?

Paul Verest
  • 60,022
  • 51
  • 208
  • 332
CrazySynthax
  • 13,662
  • 34
  • 99
  • 183
  • How do you run your unit tests? It seems that you do not run them on GraalVM? – Steves May 18 '21 at 07:54
  • You're right. I downloaded GraalVM and used it as JRE for the unit tests and it worked :-) Another problem I have is how to run the test from sbt. I run "JAVA_HOME= sbt test" and I get the error: The future returned an exception of type: java.lang.UnsupportedOperationException – CrazySynthax May 18 '21 at 15:19
  • If you have other error after some changes, then ask new question or update existing – Paul Verest Jul 26 '21 at 02:39

1 Answers1

0

Solved by ensuring that GraalVM is used by setting JAVA_HOME

Paul Verest
  • 60,022
  • 51
  • 208
  • 332