How do you compile multiple class files in a unix cmd prompt?

I have been using Java for a few years now, but for some reason I have a course that requires us to compile/run and hand-in our java assignments using Unix...

I know how to compile a simple program on unix with a single source file, but how the heck do you compile and run a program with say... 2 or more sources files linked together?

I really doubt the answer is just type

javac java1.java

javac java2.java

javac java3.java

and then running the source file with the main in it.

Hopefully someone here can help me.

Thanks

Roger

[591 byte] By [Woolzya] at [2007-10-2 9:13:17]
# 1

okay, well I took some time to read up online how to do this and I guess i'll answer my own post just in case someone else wants to know the answer.

2 ways I found were:

1)For example, you can list all of the source file names in a file named sourcefiles. This file might look like:

MyClass1.java

MyClass2.java

MyClass3.java

You could then run the compiler with:

% javac @sourcefiles

2)Or if all the files are in the same directory you can do this:

This example compiles all the source files in the package greetings.

% ls

greetings/

% ls greetings

Aloha.java GutenTag.javaHello.java Hi.java

% javac greetings/*.java

If that is confusing to read I found all the answers from this webpage:

http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/javac.html

Woolzya at 2007-7-16 23:20:19 > top of Java-index,Developer Tools,Java Compiler...