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 - Java Tutorial
From the course: Java 11+ Essential Training
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
-
-
-
-
(Locked)
Install the JDK on Windows4m 2s
-
(Locked)
Install the JDK on macOS2m 42s
-
(Locked)
Install and configure IntelliJ IDEA3m 27s
-
(Locked)
Test simple Java code in JShell4m 36s
-
(Locked)
Compile Java code to bytecode3m 42s
-
Pass arguments to a console application3m 16s
-
(Locked)
Use the Java API documentation2m 43s
-
(Locked)
-
-
-
-
-
-
-
-