Your question is unclear but I’ll try to answer anyway.
First create a file HelloWorld.java
:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
And put this file in the folder where you want to compile. Let’s assume that this folder is C:\projetos\helloworld
.
Then, at the command prompt, being in the folder C:\projetos\helloworld
, you type the following command:
javac HelloWorld.java
And then the file HelloWorld.class
should have appeared in the folder. Now you type the following command:
java HelloWorld
And then Hello World
should be printed on the console.
If this does not work, let us know what happened unexpectedly and what was the error message, if any. If it works, try to do the same with the program you want to compile.
Configured the environment variables?
– Renan Gomes
You should [Dit] the question and put more information, like the error that appeared.
– Maniero
Did you compile the. java file? Example:
javac SuaClasse.java
. The . class files are generated from the build of the . java file– Dherik
If you are starting in Java, I recommend this material: http://www.loiane.com/2013/02/instalando-e-configurando-o-java-no-windows-8/ and also the author’s own video lessons posted at the end of the article.
– Celso Marigo Jr
The question should always contain the error, so which error message?
– Guilherme Nascimento