Javac command not working in my windows 10

Java

When I do the javac command it says javac is an unknown command. i set up everything though. or at least i think i did. i am new to java so i dont know much about it.

2
Answers

Replies

1. You will need to Check your javac path on Windows using Windows Explorer C:\Program Files\Java\jdk1.7.0_02\bin and copy the address.


2. Go to the Control Panel. Environment Variables and Insert the address at the beginning of var. Path followed by semicolon. i.e C:\Program Files\Java\jdk1.7.0_02\bin; . You need not delete the path existent, just click in and go to the left end and paste the line above. Do not try anything else, because you just need to link your code to "javac.exe" and you just need to locate it.


3. Close your command prompt and reopen it,and write the code for compile and execution.

 

when we type “javac” on command prompt and if it gives any error like “javac is an unknown command” or “javac is not recognized as an internal or external command” that means javac.exe file path is not set properly. We cannot compile a java application without setting the path of “javac.exe”.


There are two ways to set the path of “javac.exe” file
Temporary
Permanent


Temporary : we can set the path of the “javac.exe” file temporarily by using the “set path” command.


In the first step, copy the path of the “javac.exe” file. As we all know that javac.exe file is located inside the bin folder of Java JDK.


In the second step, open your command prompt and type the command
“set path=C:\Program Files\Java\jdk-11.0.2\bin” and press enter.


 


Finally, The “javac.exe” file path is set successfully and now you can compile and run your java application.


Note: when we set the path of “javac.exe” file temporarily then it won’t work once the command prompt window closes.

Permanent: There are several steps to follow to set the path of “javac.exe” file permanently and the various steps are given below:

In the first step, copy the path of the “javac.exe” file. As we all know that javac.exe file is located inside the bin folder of Java JDK.


In the second step, Go to File Explorer ->Right click on This PC -> click on Properties then System dialog box will appear.


 


In the third step, Under System dialog box click on Advanced System Settings then System Properties dialog box will appear.


 


In the fourth step, In System Properties dialog box Select Advanced tab -> Environment Variables ->select PATH variable from System Variables section-> Edit->New->Paste copies path of “javac.exe”->ok->ok->ok


 


Finally, The “javac.exe” file path is set permanent successfully and now you can compile and run your java application.


Note: when we set the path of “javac.exe” file permanently then it works fine whether the command prompt window closes or not.


Now, you can simply check by typing the command “javac” onto the command prompt whether the path of the “javac.exe” file is set or not successfully.

 
 

If you want to unleash your potential in this competitive field, please visit the Java course page for more information, where you can find the Java tutorials and Java frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.