I get no output when I compile Java code from the Terminal

13,117

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
Share:
13,117

Related videos on Youtube

FRANK KARUGANDA
Author by

FRANK KARUGANDA

Updated on September 18, 2022

Comments

  • FRANK KARUGANDA
    FRANK KARUGANDA over 1 year

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

    $ ls
    hello.class hello.java 
    $ javac hello.java
    $
    
  • Frisky
    Frisky almost 8 years
    @Zannas answer is correct. But, if you just want to see some output, you can use the -verbose option.