Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

100
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda