[java] "Javac" doesn't work correctly on Windows 10

the problem is that I upgraded to Windows 10 and now I'm installing my tools to programming and now that I installed the JDK 7 of Java, when I try to use in the cmd the command: - "javac"

The result of this is: "javac" is not recognized as an internal or external command...

But I was edited the PATH with the correct link of jdk, because when I use "java", it is ok.

Now, I tried in the console with this command: PATH=%PATH%;"C:\Program Files\Java\jdk1.7.0_79\bin"

And when I executed the command "javac" it works, but now, when I open other console, it doesn't work, or when I restart the console, this command is not recognized.

What could be the problem?

This question is related to java windows java-7 javac windows-10

The answer is


The PATH is for current user, instead you can add a CLASSPATH and below link would help you more PATH and CLASSPATH


now i got it finally! make sure that there are no spaces before and after the path and put the semi-colon on both sides without spaces


just add C:\Program Files\Java\jdk1.7.0_80\bin as the path in environmental variables. no need to add java.exe and javac.exe to that path. IT WORKS


I added below Path in environment variable

C:\Program Files\Java\jdk1.8.0_91\bin

and then compiled the program but got the error then I restarted the system and again compiled the program

This time it worked :)


For some reason it worked for me to add quotation marks to the path folder on windows 10. not C:\Program Files\Java\jdk 1.8.0_111\bin, but "C:\Program Files\Java\jdk 1.8.0_111\bin".


Add java path to environment variables and move it to the top of all the paths available there. It worked for me.


I am totally new to java and spent hours trying to get the problems with PATH and CLASSPATH worked out. There was one person who said to restart the command prompt after you modify the environment variables; that was it for me. While you are testing different configurations, make sure to relaunch the command prompt before testing. It seems like there are at least 2 different ways of setting this up. I went with the following:

1) In System Variables, add

JAVA_HOME = c:\program files (x86)\java\jdk1.8.0_121

2) In System Variables, add the following to existing Path...

%JAVA_HOME%\bin

That's it. No need for quotes around anything. No double forward slashes or anything else. I think it would also work if I removed the java_home variable and just listed the explicit path to bin in the PATH variable, but I'm not touching it again now that it finally works.


After adding C:\Program Files\Java\jdk1.8.0_73\bin to the system variables I turned off my command prompt and opened another one. Then it worked.


in the search window type 'environment variables' this should give you a link to editing the variables. On the variables editing page there is an upper section and a lower section in the lower section add NEW,type path C:\Program Files\Java\jdk-10\bin this worked great for me and it finds the compiler all the time.


To be sure about your path, you can use double quotes " to locate the path or if you are in Windows, you can browse to path to select "C:\Program Files\Java\jdk1.8.0_121\bin" folder.


Maybe a bit late, but i had same problem.

Click on "Move up" button for Java path and move it at top.

It fixed problem for me


what I did is:

I typed ; accidentally in front in the path variable and then hit OK, after this if I again edit it was nowhere going to the same page as earlier, it opened a new page as defined for user variables and then I was able to remove double quotes in front of the PATH VARIABLE. Everything worked fine then. :)

Did it just now.


I added below Path in environment variable

;%JAVA_HOME%/bin instead of %JAVA_HOME%\bin

in my case , it fix the problem


Her's how I configure System variable on Windows 10 :

enter image description here


If you have set all PATH variables correctly after installation, just restart it.

I had the same problem, I had also installed new Windows7 OS then I upgraded it to Win 10. Then i started setup necessary tools like IntelliJ, Java jdk,jre, eclipse so on. In cmd, java -version worked but javac compiler got unrecognized. I checked and all good, the files in the folders, path are correct and so on.

I restarted and checked it again in cmd ,it worked.


Kind of beating a dead horse now but, I want to clarify one thing that may not be quite so obvious. Yes indeed you need to edit the PATH environment variable as already stated many times. The key for me was to edit the PATH under SYSTEM variables. I had inadvertently edited the PATH under USER variables. Why did this matter? On my machine I have to log in as an Administrator to edit environment variables. So editing the User variables was not helping because I run the command prompt under my login (non-admin) account. Grrr!

Also, I found that closing the command prompt window, and re-opening it after the PATH variable update was required. Changing the order of the values, adding semi-colons, etc. didn't make a difference for me.

Cheers


Points to remember, do as the image shows. Move the highlighted bar up using move up button, this will help.


Add

PATH = C:\Program Files\Java\jdk1.8.0_66\bin 

in Advanced system setting. Then Choose Environment Variable.


for windows 10 Users Use Java path( JDK Bin location) AS "C:\Program Files\Java\jdk-9.0.1\bin" it will work.


I had the same issue on Windows 10 - the java -version command was working but javac -version was not. There are three things I did:

(1) I downloaded the latest jdk (not the jre) and installed it. Then, I added the jdk/bin path tan o environment variable. In my case, it was C:\Program Files\Java\jdk-10\bin. I did not need to add the ; for Windows 10.

(2) Move this path to the top of all the other paths.

(3) Delete any other Java paths that might exist.

Test the java -version and javac -version commands again. Voila!


Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to windows

"Permission Denied" trying to run Python on Windows 10 A fatal error occurred while creating a TLS client credential. The internal error state is 10013 How to install OpenJDK 11 on Windows? I can't install pyaudio on Windows? How to solve "error: Microsoft Visual C++ 14.0 is required."? git clone: Authentication failed for <URL> How to avoid the "Windows Defender SmartScreen prevented an unrecognized app from starting warning" XCOPY: Overwrite all without prompt in BATCH Laravel 5 show ErrorException file_put_contents failed to open stream: No such file or directory how to open Jupyter notebook in chrome on windows Tensorflow import error: No module named 'tensorflow'

Examples related to java-7

How to enable TLS 1.2 in Java 7 "Javac" doesn't work correctly on Windows 10 invalid target release: 1.7 No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? How to set specific Java version to Maven Which JDK version (Language Level) is required for Android Studio? How to set -source 1.7 in Android Studio and Gradle Technically what is the main difference between Oracle JDK and OpenJDK? Create a Path from String in Java7 How to set IntelliJ IDEA Project SDK

Examples related to javac

Setting up enviromental variables in Windows 10 to use java and javac "Javac" doesn't work correctly on Windows 10 Error:java: invalid source release: 8 in Intellij. What does it mean? Javac is not found Maven Unable to locate the Javac Compiler in: Unable to locate an executable at "/usr/bin/java/bin/java" (-1) javac is not recognized as an internal or external command, operable program or batch file javac option to compile all java files under a given directory recursively Creating a batch file, for simple javac and java command execution javac : command not found

Examples related to windows-10

Starting ssh-agent on Windows 10 fails: "unable to start ssh-agent service, error :1058" How to install OpenSSL in windows 10? Anaconda Installed but Cannot Launch Navigator Conda command is not recognized on Windows 10 Copy Files from Windows to the Ubuntu Subsystem Hyper-V: Create shared folder between host and guest with internal network Why Local Users and Groups is missing in Computer Management on Windows 10 Home? VMware Workstation and Device/Credential Guard are not compatible pip not working in Python Installation in Windows 10 Copy Paste in Bash on Ubuntu on Windows