4

When I try to run my Hello World program it doesn't show any output:

$ ls
hello.class hello.java 
$ javac hello.java
$
Zanna
  • 70,465

1 Answers1

18

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
Zanna
  • 70,465
  • 1
    @Zannas answer is correct. But, if you just want to see some output, you can use the -verbose option. – Frisky Jul 10 '16 at 18:12