'javac' is not an internal or external command, an executable program, or a batch file.

Asked 2 years ago, Updated 2 years ago, 110 views

I'm a beginner who started trying to learn java ambitiously.

I finished setting the installation and environment variables yesterday Today, I was learning the compilation of the 'Java Development Order' course.

public class HelloWorld{ public static void main(String args[]){ System.out.println("Hello World"); } }

Q1) What did I do wrong? (Someone said that the path was wrong, so I looked carefully from the beginning, but there was no problem. My computer is Win10 and the lecture taught me setting environment variables based on Win8.1. There's not much difference, so I copied you)

Q2) What is the solution?

javac

2022-09-22 16:12

1 Answers

When you install Java, you must install the Java Development Kit (JDK). First, check if you have installed JDK. JDK Download URL Note: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

If you have installed JDK and it doesn't work, you can set the environment variable (Windows 7, 8.1, 10 the same), and PATH should hold the bin path below the JDK path (typically C:\Program Files\Java\jdk....).

PATH
....<Previous Settings>;C:\Program Files\Java\jdk1.8.0_72\bin;

If you are finished as above, try running cmd again.

(Additional questions)

PATH 
%JAVA_HOME%\bin;C:\ProgramData\Oracle\Java\javapath;C:/Windows/Microsoft.NET/Framework/v4.0.30319;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\Program Files\Skype\Phone\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ 

In the lecture, I heard that if you put %JAVA_HOME%\bin in the far left front of PATH as above, you will have an environment where you can run Java's executable files on any path. And yet...No...

I included the question in my answer because you asked me to edit it.

(Additional answers)

Did you set the environment variable JAVA_HOME? Like setting PATH, JAVA_HOME should hold the environment variable. %JAVA_HOME% between % and % is the environment variable. Therefore, if the environment variable JAVA_HOME is not present, it will not work. See the link .


2022-09-22 16:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.