When I try to run my Hello World program it doesn't show any output:
$ ls
hello.class hello.java
$ javac hello.java
$
You can see from ls
that you already compiled your program with the compiler javac
. The command you used
javac hello.java
creates hello.class
without sending any output to stdout, so there won't be any messages in your terminal unless there are errors - what you see is the expected behaviour. If you actually want to see some output, you can add an option: javac -verbose hello.java
as mentioned by @Frisky (thanks!)
Now you can run that file hello.class
with
java hello
javac
was just the compiler, then once it's compiled you run your program withjava