Abstract
jshell is a useful utility tool that adds the Read-Eval-Print Loop (REPL) to Java. It allows developers to try Java language features interactively or to evaluate some expressions quickly. For example, it’s common for Java programs to write files to the system’s temporary directory. Sometimes you may want to check the temporary directory to verify the contents of created files. To get the path of the temporary directory, you need to get the value of the Java system property, java.io.tmpdir. You can do this by creating a simple Java program that has a main method to output the value, or you can use the Apache Groovy Console (http://groovy-lang.org/groovyconsole.html) to quickly run the code. But writing another Java program seems like overkill for simple tasks like this, and using Groovy Console requires that you downloaded and install Groovy. Neither approach seems ideal. Now you have a better choice in Java 9—jshell.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2018 Fu Cheng
About this chapter
Cite this chapter
Cheng, F. (2018). jshell. In: Exploring Java 9. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3330-6_3
Download citation
DOI: https://doi.org/10.1007/978-1-4842-3330-6_3
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-3329-0
Online ISBN: 978-1-4842-3330-6
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)