Win10 installs java environment variables, javac system cannot find the path
Now many new java learners fail to install environment variables according to the tutorial on Baidu. Java can run under cmd, but javac cannot run. This is because of win10 or jdk. Follow me to
see
Let's configure environment variables with me!
First of all, we have to download a jdk
download official website, here is
the official website address, click here,
go in ,
find,
download and install , then if there is no jre
in the installed directory, if there is, ignore this step, jre is not installed by default after jdk12, you have to install it yourself
If there is no jre generation method
① Go to D disk (assuming that jdk is installed on d disk) d: Then cd to open the jdk installation directory
cd javajbk\jdk14 (run as an administrator)
How to run as an administrator is under the computer Search for cmd, then right-click to run as an administrator
②bin\jlink.exe --module-path jmods --add-modules java.desktop --output jre,
then copy the code in the second step and press Enter to generate jre
)
After you have jre, you can configure environment variables. Open my computer properties like the previous Baidu tutorial.
Follow along and write your own jdk path later.
Configure the path and remember that win10 must use an absolute path.
Double-click to open
and confirm and it will be OK.
Finally configure CLASSPATH
.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools. jar;
Just copy mine and it will be OK, be careful not to forget the small dot in front