.class file is not generated

0

I have already tested through the command prompt, and java and javac are installed. The problem is that the .class file is not created.

By typing the directory I can find the folder, but not the file I want inside the folder (an error message appears).

    
asked by anonymous 07.03.2015 / 15:16

1 answer

2

Your question is not clear but I will try to respond 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, while in the C:\projetos\helloworld folder, you type the following command:

javac HelloWorld.java

And then the HelloWorld.class file 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, tell what happened unexpected and what the error message was, if any. If it works, try doing the same with the program you want to compile.

    
07.03.2015 / 17:33