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

101
Visualizações
Want to run JavaScript code snippet which returns Boolean with the help of java

I want to run a JavaScript code snippet which returns boolean, from java.

Currently I am using ProcessBuilder to run the JavaScript program with the command jjs filename.

I am able to perform the operations and getting the output from getOutputStream properly.

But my requirement is to return boolean from the script, when I make the similar changes in the script it gives compile time error invalid return statement, which is obvious.

when I use

var a=5; var b=6; print(a+b);

I am getting a output 11. But I want to execute a script like

var a=5; 
if(a>0) 
    return true; 
else 
    return false;

I get errorStream like Invalid return statement Expected eof but found } } ^

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The getInputStream method of the ProcessBuilder class gives you a stream from which you can read bytes. You have to convert the bytes to String and then parse to boolean.

about 4 years ago · Juan Pablo Isaza Relatório
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