Debugging while using redirected input.

Discussion in 'Java' started by andrew.butt@gmail.com, Feb 28, 2006.

  1. Guest

    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.
    , Feb 28, 2006
    #1
    1. Advertising

  2. Alex Guest

    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.
    Alex, Feb 28, 2006
    #2
    1. Advertising

  3. Guest

    Thanks alot, exactly what I needed :)
    , Feb 28, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ^CrazyCoder^
    Replies:
    3
    Views:
    7,244
    Terrence Benade
    Sep 15, 2003
  2. Steve Harris
    Replies:
    6
    Views:
    5,119
    Steven Cheng[MSFT]
    Sep 23, 2004
  3. not your business

    Re: How Do You Get Redirected Input?

    not your business, Jul 2, 2003, in forum: Python
    Replies:
    1
    Views:
    338
    Bengt Richter
    Jul 2, 2003
  4. Irishmaninusa
    Replies:
    0
    Views:
    145
    Irishmaninusa
    Sep 23, 2004
  5. Will
    Replies:
    5
    Views:
    272
    Alan J. Flavell
    Dec 2, 2003
Loading...

Share This Page