Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'javac' is not recognized as an internal or external command

I have to convert my Matlab algorithm in Java. For this I'm using matlab builder ja toolbox, after following all the necessary steps, the build fails and this error is displayed:

'javac' is not recognized as an internal or external command, operable program or batch file. Error: An error occurred while shelling out to javac (error code = 1). Unable to build executable.

When typing java -version in the matlab command line, this is what i get:

Java 1.6.0_12-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode

It means I should have this compiler of java installed on my computer, only then the matlab builder ja works. I'm new to Java, I'm not sure what compiler I should be looking for.

like image 303
user3801619 Avatar asked Jul 03 '14 12:07

user3801619


People also ask

Why javac is not Recognised in command prompt?

It means that the javac.exe executable file, which exists in the bin directory of the JDK installation folder is not added to the PATH environment variable. You need to add the JAVA_HOME/bin folder in your machine's PATH to solve this error.

Why am I getting Java is not recognized as an internal or external command?

The Java is not recognized as an internal or external command in Command Prompt error occurs if the environment variables are not configured correctly. By adding the correct path to an environment variable, you can resolve the issue. If the error persists, try installing the compatible Java version.


1 Answers

  • First make sure you have installed jdk and jre, both are installed with the java software development kit. The installation folder is typically C:\Program Files\Java.

  • Now go to Computer > Properties > Advanced system settings in the advanced tab click on Environment Variables

  • In System variables find the variable named Path, in the value of Path you will find a java path like C:\ProgramData\Oracle\Java\javapath, just change it to C:\Program Files\Java\jdk1.x.x_x\bin.

Hope that helps.

like image 195
Jhossep Augusto Popayán Avila Avatar answered Sep 19 '22 20:09

Jhossep Augusto Popayán Avila