Jshell is not recognized as an internal or external command, operable program or batch file

JShell is a Java REPL tool introduced in JDK 9 (for more information, see JEP 222). It enables you to interactively evaluate Java expressions without the overhead of creating an executable class, compiling your code, and so on.

IntelliJ IDEA includes a basic console for working with JShell from inside the IDE, similar to the Groovy Console. You can use the JShell Console to try out code snippets, which can even reference the classes defined in your project.

Open the JShell Console

  • From the main menu, select .

This opens the JShell Console tab in the editor, where you can type Java code, for example:

String name = "John"; System.out.println("Hello " + name);

Press Ctrl+Enter to run this code in JShell. You should see the following output in the Run tool window:

Defined field String name = "John" System.out.println("Hello " + name) Hello John

In order to use the JShell Console, you need to have Java 9 or later available. You can run IntelliJ IDEA on an older runtime, and your project can use an older JDK, but you must select a supported Java version from the JRE list at the top of the JShell Console tab. Or click

Jshell is not recognized as an internal or external command, operable program or batch file
to specify the path to a valid Java version.

By default, all libraries that your project depends on are available to the JShell Console. You can use the Use classpath of list to select a specific module.

Last modified: 26 July 2022

How to fix the ‘Java not recognized’ error

Here are the three easiest ways to fix Java’s “not recognized as an internal or external command” error:

  1. Install or reinstall Java and the JDK on your computer
  2. Add Java’s bin directory to the computer’s PATH
  3. Restart the command prompt, terminal window or PowerShell

Jshell is not recognized as an internal or external command, operable program or batch file

If the JDK is not installed or the PATH is misconfigured, a ‘Java not recognized’ error results.

Is Java installed?

To run the Java command, first you must have Java installed. This means either the Java Runtime Environment (JRE) or the full Java Development Kit (JDK).

There are many ways to install Java on Windows or Ubuntu Linux. Here are two simple examples.

Install Java on Ubuntu

To install Java on Ubuntu, a single apt install command is sufficient:

sudo apt install default-jre Setting up default-jre (2:1.11-72build2) ...

Install Java on Windows

To quickly perform a Java install on Windows, download the Adoptium JDK and run the .msi file, selecting all of the default options.

Jshell is not recognized as an internal or external command, operable program or batch file

If Java is not installed, you will not be able to fix the ‘Java not recognized’ error.

Add Java to the PATH

You’ll find the Java executable file in the JDK installation’s \bin directory.

If the \bin directory of the JDK or JRE is not added to the Windows or Linux PATH variable, programs may not be able to find it at runtime. This would certainly cause the “Java not recognized” error, even if the JDK or JRE is properly installed.

Jshell is not recognized as an internal or external command, operable program or batch file

Make sure Java’s /bin directory is on the path to avoid internal or external command errors.

Restart the terminal window

The terminal window and the command prompt only read environment variables when they first start up.

If the JDK has been installed and the PATH variable set properly, you will still encounter a “‘Java not recognized” error if you did not restart PowerShell or the command prompt.

Restart your terminal window, or the application that needs to find the Java command, and try again. The “Java not recognized” error should go away for good.

Full text of Java error

The full text of the Java not recognized error is as follows:

C:\java-error-fix> java -version 'java' is not recognized as an internal or external command, operable program or batch file.

When Java is installed and configured properly, this error will go away.

How do I activate JShell?

To start JShell, enter the jshell command on the command line. JDK 9 must be installed on your system. If your path doesn't include java-home/jdk-9/bin , start the tool from within that directory.

How do you get JShell on Windows?

To start Jshell, first we must have installed Java 9 then open terminal in Linux or command prompt in windows and type jshell ? v. It will start jshell session and displays a welcome message to the console.

How install JShell Linux?

Steps to follow:.
Download Java 9 from scratch and install..
Run the shell..
Get help from Java 9's REPL..
Run a few calculations in JShell..
Define a function and use it..

How do I run a JShell in eclipse?

JShell in Eclipse.
Select "Run > External Tools > External Tools Configuration".
Enter the following settings: Name: JShell. Location: /usr/bin/jshell -- or whereever your jshell command is found on your system. Working Directory: ${project_loc} Arguments: --class-path "${project_classpath}".