Home  >  Article  >  Java  >  How to solve Java is not an internal or external command, nor is it an operable program issue?

How to solve Java is not an internal or external command, nor is it an operable program issue?

PHPz
PHPzforward
2023-04-20 19:01:075458browse

Brief description

When I was learning to use the Java command line to compile java files, I encountered this problem

Windows operating system error message

"‘javac’is not recognized as an internal or external command, operable program or batch file"

Let’s talk about the solution

Reply to the comment area that the environment variable cannot be found And the friend of user variables

Posting blindly

How to solve Java is not an internal or external command, nor is it an operable program issue?

Solution process

According to the research, there is actually no Installed (or installed but not set in the environment variables)

Step one: Download the corresponding JDK on the website (Just use Just download JDK)

How to solve Java is not an internal or external command, nor is it an operable program issue?

Just click on the place circled in the picture above (If there is a newer version, the operation should be similar )

Install boldly. In fact, this installation is very fast. (When installing, I directly selected the default address (of course the corresponding address is also ok))

The address where my JAVA file is located: C:\Program Files\Java (If you don’t remember, you can reinstall it)

After installation, you need to configure the environment variables. The specific configuration is as follows

In the user variables , add a new variable named java_home and the address is C:\Program Files\Java\jdk-10.0.2. Note that my previous JAVA The address where the file is located.

Add a variable to Path. The respective addresses are C:\Program Files\Java\jdk-10.0.2\bin

There may be other problems

Finished After the above operations, it may still not work. There are two solutions here.

  • The first one, restart itcmd

  • ##The second one, go to

    Path, adjust the location of the two bin folders ( move up to the top), and then restart cmd

You can know from the second method above that, in fact, the javac exe file is in the bin folder (the one of jdk).

The effect after the solution

is as follows

How to solve Java is not an internal or external command, nor is it an operable program issue?

The above is the detailed content of How to solve Java is not an internal or external command, nor is it an operable program issue?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete