0

I am trying to compile and run a program on my Mac, but the program has multiple classes. I usually use Terminal (Mac equivalent of Windows Console) to compile and run my programs.

The steps I take are:

cd TheDirectoryTheProgramIsIn (directory)

javac filename.java (compile)

java filename (run)

So what I know already is that each class has to be in separate files. I was also informed of something called a package, and I don't know what that is. Maybe that is relevant.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Braini
  • 1
  • 1
  • Thank you for the help, but I figured it out myself! What I did was compile the files without the main method first, then compiled the file with the main method. When I ran the file with the main method, it worked perfectly. – Braini Jan 03 '21 at 02:51
  • 2
    You may want to spend more time on teaching materials. This is pretty basic stuff so it is most likely covered in what you already have. – Thorbjørn Ravn Andersen Jan 03 '21 at 05:46

0 Answers0