I get no output when I compile Java code from the Terminal
up vote
4
down vote
favorite
When I try to run my Hello World program it doesn't show any output:
$ ls
hello.class hello.java
$ javac hello.java
$
command-line java compiling gedit
add a comment |
up vote
4
down vote
favorite
When I try to run my Hello World program it doesn't show any output:
$ ls
hello.class hello.java
$ javac hello.java
$
command-line java compiling gedit
1
I thoughtjavac
was just the compiler, then once it's compiled you run your program withjava
– Nick Weinberg
Jul 10 '16 at 14:32
2
Possible duplicate of How to run a Java program in Ubuntu
– karel
Jul 10 '16 at 14:33
6
Please don't post screenshots of text. Instead, paste the text directly into your question and use the formatting tools.
– terdon♦
Jul 10 '16 at 14:53
1
@terodactyl fixed
– cat
Jul 11 '16 at 12:07
add a comment |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
When I try to run my Hello World program it doesn't show any output:
$ ls
hello.class hello.java
$ javac hello.java
$
command-line java compiling gedit
When I try to run my Hello World program it doesn't show any output:
$ ls
hello.class hello.java
$ javac hello.java
$
command-line java compiling gedit
command-line java compiling gedit
edited Jul 12 '16 at 5:28
Zanna
49.2k13124234
49.2k13124234
asked Jul 10 '16 at 14:26
FRANK KARUGANDA
2113
2113
1
I thoughtjavac
was just the compiler, then once it's compiled you run your program withjava
– Nick Weinberg
Jul 10 '16 at 14:32
2
Possible duplicate of How to run a Java program in Ubuntu
– karel
Jul 10 '16 at 14:33
6
Please don't post screenshots of text. Instead, paste the text directly into your question and use the formatting tools.
– terdon♦
Jul 10 '16 at 14:53
1
@terodactyl fixed
– cat
Jul 11 '16 at 12:07
add a comment |
1
I thoughtjavac
was just the compiler, then once it's compiled you run your program withjava
– Nick Weinberg
Jul 10 '16 at 14:32
2
Possible duplicate of How to run a Java program in Ubuntu
– karel
Jul 10 '16 at 14:33
6
Please don't post screenshots of text. Instead, paste the text directly into your question and use the formatting tools.
– terdon♦
Jul 10 '16 at 14:53
1
@terodactyl fixed
– cat
Jul 11 '16 at 12:07
1
1
I thought
javac
was just the compiler, then once it's compiled you run your program with java
– Nick Weinberg
Jul 10 '16 at 14:32
I thought
javac
was just the compiler, then once it's compiled you run your program with java
– Nick Weinberg
Jul 10 '16 at 14:32
2
2
Possible duplicate of How to run a Java program in Ubuntu
– karel
Jul 10 '16 at 14:33
Possible duplicate of How to run a Java program in Ubuntu
– karel
Jul 10 '16 at 14:33
6
6
Please don't post screenshots of text. Instead, paste the text directly into your question and use the formatting tools.
– terdon♦
Jul 10 '16 at 14:53
Please don't post screenshots of text. Instead, paste the text directly into your question and use the formatting tools.
– terdon♦
Jul 10 '16 at 14:53
1
1
@terodactyl fixed
– cat
Jul 11 '16 at 12:07
@terodactyl fixed
– cat
Jul 11 '16 at 12:07
add a comment |
1 Answer
1
active
oldest
votes
up vote
15
down vote
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
@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
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
15
down vote
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
@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
add a comment |
up vote
15
down vote
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
@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
add a comment |
up vote
15
down vote
up vote
15
down vote
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
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
edited Jul 11 '16 at 7:52
answered Jul 10 '16 at 14:38
Zanna
49.2k13124234
49.2k13124234
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
add a comment |
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
1
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
@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
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f797025%2fi-get-no-output-when-i-compile-java-code-from-the-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I thought
javac
was just the compiler, then once it's compiled you run your program withjava
– Nick Weinberg
Jul 10 '16 at 14:32
2
Possible duplicate of How to run a Java program in Ubuntu
– karel
Jul 10 '16 at 14:33
6
Please don't post screenshots of text. Instead, paste the text directly into your question and use the formatting tools.
– terdon♦
Jul 10 '16 at 14:53
1
@terodactyl fixed
– cat
Jul 11 '16 at 12:07