0

I am using Eclipse for java and I just created a program I am trying to run on the terminal window for Mac. Every time I try to run it I get a No such file or directory. In the terminal window I moved to the source folder. Is this where I am supposed to be to run java programs from Eclipse? My command is listed below with the two text files (in1.txt) and (in2.txt) that have text in them.

java Cat in1.txt in2.txt out.txt

My code is provided below.

public class Cat {
public static void main(String[] args) {
    Out out = new Out(args[args.length -1]);
    for(int i = 0; i < args.length -1; i++)
    {
        In in = new In(args[i]);
        String s = in.readAll();
        out.println(s);
        in.close();
    }
    out.close();

  }
 }
Pradeep Pati
  • 5,779
  • 3
  • 29
  • 43
DaBulls33
  • 171
  • 3
  • 6
  • 16

1 Answers1

0

cd to the directory where Cat.class is located before you run the java command.

Hot Licks
  • 47,103
  • 17
  • 93
  • 151