solomkinmv
solomkinmv

Reputation: 1952

How to watch java error output by pages?

I have a program which throws StackOverflowException. So the error output is very big and I can't read beginning of output from terminal. How can I watch all program output?

I know that there is something like pagination in terminal. I've googled about it and found advice to use more or less commands.

So I've tried...

java Program | less

But it doesn't work. What am I doing wrong?

Upvotes: 1

Views: 69

Answers (3)

accurate respondetur
accurate respondetur

Reputation: 702

You can redirect the output to a file

java myProgram &>file.log

Then you can tail , head or grep that file.

Upvotes: 1

Use a good IDE (Integrated Development Environment) such as Eclipse. Any decent IDE will have a debugger mode.

Java is a both compiled and interpreted language, which gives it speed and is also easy to debug.

IDE debuggers will walk you through the program execution step by step, which can help you to find errors in your program that you might not otherwise see.

Upvotes: 0

Victory
Victory

Reputation: 5890

Assuming you are using bash4 you can use the |& to concat std error.

java Program |& less

Upvotes: 4

Related Questions