Javac does not compile .java

2

The return error is this, when I'm already in the folder this information appears:

--javac Main.java

'--javac' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.

I tried without traces and even with a trace. I'm using Intellij Idea as IDE.

    
asked by anonymous 04.09.2014 / 13:43

3 answers

11

After you install JDK (Java Development Kit), open the properties of your computer, ( +PauseBreakorStart→ControlPanelSystem)andclickAdvancedSystemSettings.

ClickEnvironmentVariables...

ClickNewandcreatethefollowingtwovariables:

CLASSPATH=.;%JAVA_HOME%JAVAHOME=CaminhodoJavainstalado

Aftercreatingthevariables,editthePathvariableandplaceasemicolon(;)attheendofthevalueandaddthepathofthebinfolderwhereJavawaspreviouslyinstalled:

After setting up these steps, restart your computer to apply the settings, and you can compile your .java code by simply typing javac and the name of the .java file in Windows prompt . And running by reporting java followed by the previously compiled class.

To make the response documented ...

    
04.09.2014 / 14:37
2

Do you configure the compiler path? possible solution This IDE you are using may not compile directly, recognizing the path of the compiler; Did you check this out?

Tried to compile through the direct prompt?

    
04.09.2014 / 13:49
0

Whenever you access a system to program in Java, run java -version to find out if Java is installed.

If this is already installed, this problem occurs because of unset environment variables. The operating system uses the PATH to save paths that can be accessed globally within the operating system, without specifying the total path, just the file name in a folder.

As javac is in PROGRAM FILES / JAVA 1.6 / bin, you need to create this entry in the environment variables, thus allowing global access to the contents of this folder.

    
06.09.2014 / 15:01