4

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

$ ls
hello.class hello.java 
$ javac hello.java
$
4

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .