简体   繁体   中英

Javac is not recognized even after setting the path

I have installed my jdk file. I have also set my path in the advanced setting in the user variable as well as system variable. When I tried to compile my program through javac filename.java the command prompt is showing javac is not recognized as an internal or external command. I again set my path but still the problem remains the same

This problem happens when you define your JAVA_HOME under User variables and not under the system variables.

Try moving the JAVA_HOME to System Variables and restart the command prompt. It will work like a charm.

I see that the System variable Path has an entry to C:\\ProgramData\\Oracle\\Java\\javapath . But that location doesn't have the Javac executable.( javac.exe ). Adding the JDK bin path solved the problem for me. (Added C:\\Program Files\\Java\\jdk1.8.0_121\\bin to Path )

To solve this on Windows follow these:

Step 1:Go to advanced system settings in property page of Control panel

Step 2:Select Advanced Tab

Step 3:Select Environmental Variables Tab on Bottom

Step 4:See under System Variables Heading

Step 5:Locate "Path" variable and click edit

Step 6:You will see a new editing window

Step 7:click Browse Button on Right and locate bin of JDK installed on your System

And at last select ok, ok and ok! Thus you are all set

If your java application crashes Then follow:

Step 1:Search for Configure Java application on Windows search tab

Step 2:Select Java tab

Step 3:You will see user and system tab

Step 4:One by One on each tab select Find button on bottom

Step 5:Locate Java Runtime or jrex.x.x_x named folder and thus all is done!

As JDK INSTALLATION ON MICROSOFT WINDOWS suggests that adding the full path of JDK-14\\bin to PATH VARIABLE for permanently, didn't work for me and adding a new variable to system variable JAVA_HOME with same path as PATH variable "C:\\Program Files\\Java\\jdk-14\\bin" solves my issue. Give the above path to both JAVA_HOME and PATH system variables.

I don't know how many methods there are to resolve this problem, but I have the easiest way to do this. Just follow the following methods:

  1. After installing jdk, open Advanced system setting which is located in System .
  2. Then open environment variables.
  3. Under system variables search for Path and delete it.
  4. Again under system variables click on New command. Under variable name write Path and under variable value copy the path of jdk you installed << C:\\Program Files\\Java\\jre\\bin >>. and save it.
  5. Now open cmd prompt and write javac . It will work

I had a similar problem. after setting path as described above.

  1. I opened the command prompt
  2. typed Path%JAVA_HOME%
  3. press enter

It worked

Try this.

  1. Mannually copy the JDK, bin directory. (EX: C:\\Java\\jdk1.8.0_152\\bin)
  2. Then run following command in cmd. "C:\\Java\\jdk1.8.0_152\\bin\\java" -version Command Prompt

Seems you JDK is corrupted. Download new JDK and setup Environment as you mentioned in the question.

I had a similar problem, as on the oracle website it is mentioned to append the directory to path system variable, but it worked for me when I appended the path user variable. Please make the changes in path user variable. This is for jdk 14, it comes with a private jre and recognised when path is added.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM