From the course: Java 11+ Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Test simple Java code in JShell

Test simple Java code in JShell - Java Tutorial

From the course: Java 11+ Essential Training

Start my 1-month free trial

Test simple Java code in JShell

- [David] The JShell command was added in Java 9. JShell lets you enter simple Java statements without having to create a whole application. You can use it to test simple code before you add it to a Java class. You can run JShell from anywhere on your file system as long as you've added the appropriate directory to your system path. On Mac, this is done automatically for you. If you have JDK 8, 9 or later installed, you should be able to go to Terminal and type JShell, and you should see the JShell environment pop up. To exit JShell, type /exit, and then you can exit your terminal window. If you're working on Windows, make sure that you've added the Java Development Directory's Bin subdirectory to your system path. Then you should be able to do exactly the same thing in a command prompt or from PowerShell. Now, I prefer to run JShell from within IntelliJ IDEA using a terminal window. But to do that, you have to have…

Contents