Debugging while using redirected input.

A

andrew.butt

Hello, I am a new Java programmer and am trying to debug a simple
program which uses redirected input from a text file, I usually launch
it from a linux prompt using... java sample.java < text.txt ... The
problem I am having is that the only debugger am I familiar with is
Eclipse's own, and I cannot seem to figure out how to redirect input in
the same way.

If anyone could tell me how to acomplish this, or recommend another
program and explain how to with that one I would be greatly in your
debt.

Thanks in advance.
 
A

Alex

This is java. And even, for unknown reason, you want to work only with
System.in you can always change it.

So, for dubigging purpose, add one line in the beginning of your main
method:
System.setIn(new FileInputStream("text.txt"));
and it will read this particular file instead of System.in.

Alex.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top