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
Related videos on Youtube
Author by
FRANK KARUGANDA
Updated on September 18, 2022Comments
-
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 $
-
Nick Weinberg almost 8 yearsI thought
javac
was just the compiler, then once it's compiled you run your program withjava
-
karel almost 8 yearsPossible duplicate of How to run a Java program in Ubuntu
-
terdon almost 8 yearsPlease don't post screenshots of text. Instead, paste the text directly into your question and use the formatting tools.
-
cat almost 8 years@terodactyl fixed
-
-
Frisky almost 8 years@Zannas answer is correct. But, if you just want to see some output, you can use the -verbose option.