Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

253
Visualizações
Use import in javascript being called from Java program through graalvm

I am trying out Graalvm for a use case and I was wondering if I can use import statements in the javascript being called from java. I have tried both:

context.eval("js", "import v4 from 'uuid';var o = v4();");

which gives the error Expected an operand but found import import v4 from 'uuid';var o = v4();

and

creating a separate script containing

import v4 from 'uuid';
var uu = v4();

then running the script via

InputStream inputStream = Controller.class.getResourceAsStream("/script.js");
String script = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
context.eval("js", script);

which returns the same error: Expected an operand but found import import v4 from 'uuid';

I went through the docs and it seems like it is possible. Can someone please guide me towards the correct approach?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda