Class setting. javac is not recognized

I am trying to run my java program from the command line.

I read an article about setting classpath, but I get a javac error message that is not recognized as an internal or external command. What should I do? (I do not want to set a constant CLASSPATH) This is what I did on my command line

D:\user> set path=%path%;C:\Program Files\Java\1.7.0_07\bin D:\user> cd testing D:\user\testing> javac firstProgram.java 'javac' is not recognized as an internal or external command, operable program or batch file. 

thanks

+4
source share
7 answers

Assuming PATH is correct 1, the most likely reason is that you have JRE installed ... and the JRE does not include the java compiler. You need to install the JDK if you want to compile from the command line.

(You can confirm this by looking in the C:\Program Files\Java\1.7.0_07\bin to see if it contains the javac.exe file. There will be no JRE ...)

Where can I find the Java compiler to download ..

You need to download one of the JDK installers; see http://www.oracle.com/technetwork/java/javase/downloads/index.html


1 - I do not think that quotes are required in the PATH variable on Windows. At least that is what the various examples Google apparently found for me mean. But I never understood the citation logic in Windows ...

+8
source

Better do it in an environment variable and check it out!

enter image description here

0
source

His problem is with the program files .

First, make sure your JDK folder is installed in Program Files or Program Files (x86) or in any other folder.

Then you should use the path to the bin folder in the ". Since the command line breaks the line in space. When you write it to" ", then it will be in the form of a whole line.

You are trying to execute these commands

 set path=%path%;"C:\Program Files\Java\1.7.0_07\bin" 

or

 set path=%path%;"C:\Program Files(x86)\Java\1.7.0_07\bin" 

It can help you get out of this.

0
source

try to run the command from the command line C: \ Program Files \ Java \ 1.7.0_07 \ bin \ javac ab.java

It is just to check your javac

0
source

Here you can set the path temporarily, that is, if you close and reopen the "command line", you will have to set the path again.

Assuming the path is C:\Program Files\Java\jdk1.6.0\bin

TYPE IN C: \ Program Files \ Java \ jdk1.6.0 \ bin AND HIT ENTER what it is.

0
source

Commands D:\user> set path=%path%;C:\Program Files\Java\1.7.0_07\bin work well for me

0
source

Add to this some information:

Check the version of JDK and JRE installed on your computer. I recently encountered the same problem even after installing PATH. It gives the error "javac - command not recognized"

The solution should be similar to the JDK as well as the JRE

For example: JDK 1.7.75 along with JRE 1.7.75

0
source

Source: https://habr.com/ru/post/1438122/


All Articles