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

430
Visualizações
How to shutdown jshell at the end of the script?

How to instruct jshell to terminate at the end of the script similarly to interpreters of other languages like for example python3 or node?

Following command

./jshell -q /tmp/shell.java

with script /tmp/shell.java

System.out.println("Hello world");

prints

Hello world
jshell> 

and waits for further commands. I'd like it to stop immediately at the end of the file.

I'm looking for something more elegant than System.exit(0); at the end of the script.

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Inside the script, use the jshell command /exit. This will exit jshell at the end of your script.

Check this reference https://docs.oracle.com/javase/9/jshell/introduction-jshell.htm#JSHEL-GUID-465BA4F5-E77D-456F-BCB7-D826AC1E18AE

about 4 years ago · Santiago Trujillo Relatório

0

Another possibility is to have an exit file:

exit.jsh

/exit

And then run:

./jshell --startup myscript.jsh --startup exit.jsh
about 4 years ago · Santiago Trujillo 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