Cannot run "Hello World" from terminal

I just started the basic course and tried to run the Main.java from the terminal.
(Windows 10 / Java 16)
When I try to run the code a window open asking me which program I like to use to open Main.java.
I assume this type of executable is not registered on the Windows OS.
Has anybody a suggestion on how to fix this?

Now I installed Java Runtime on my PC, associated the .java files with the java.exe and the result looks like this:

Additionally I can see no Main.class entry in the folder tree. How to get that class? In the training video this Main.class seem to com out of thin air. There are no explanations how this Main.class is created.

Do you need to compile your Main.java into Main.class? You could try

javac Main.java

from your terminal, or there’s probably a way to compile it from your IntelliJ IDE. Once it’s compiled, the Java runtime should be able to run Main.class.

1 Like

I read some papers from the Java page on the Oracle website in the meantime. My issues have only to do with the path settings for the Main.class.
When I run the Main.class from the Terminal with this code:

C:>java -classpath “C:\Users\mhsch\IdeaProjects\Hello World 1\out\production\Hello World 1” com.blx77.Main Main

Everything works fine.

Thanks for the feedback.