First, the good news. Your professor uses a Mac. You might consider asking for an Xcode template. That way, the professor will know you are a Mac user too <wink, wink>
Now the bad news. Xcode4 is really designed for iOS and Mac App Store development. You can use it for other types of projects, including Java, but you will have more work to do. Xcode3 is a far better general-purpose IDE. It is a bit of a pain to get Xcode3 running on Lion.
I was able to get Xcode4 to compile and run a Java project. Here is how to do it. If anyone can offer any improvements, please do so.
1) File > New > New Project > Other > External Build System
2) Give it some name and save it somewhere.
3) File > New > New File > Other > Empty
4) Give it a Java-friendly name. In my example, use "HelloWorld.java"
5) Copy the contents below into the file and save.
6) File > New > New File > Other > Empty
7) Save as "Makefile".
8) Copy the contents below into the file and save.
9) The "Run" (>) button should at least compile your Java now.
Now it gets tricky. You don't have to do the next part. You could just open a Terminal to your project directory and run "java HelloWorld" if you want. I strongly suggest that. You can also just type "make" and use Xcode purely as a text editor.
9) Project > Edit Scheme > Debug > Info
10) Executable > Other > type ^⌘g > type "/bin" > choose "sh"
11) Arguments
12) Set "Base Expansion on" whatever you named your target
13) Add an argument '-c "/usr/bin/java -classpath $(PROJECT_DIR) HelloWorld"' for this example.
14) Cross your fingers
15) Click the "Run" (>) button.
PS: I have no idea how to run the Java debugger in Xcode. But then, I have no idea how to run the Java debugger at all.
Here are some starter file contents:
HelloWorld.java:
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello, World!");
}
}
Makefile:
# A simple makefile for a Hello World Java program
# Define a makefile variable for the java compiler
JCC = javac
# Define a makefile variable for compilation flags
# The -g flag compiles with debugging information
JFLAGS = -g
# typing 'make' will invoke the first target entry in the makefile
# (the default one in this case)
default: $(subst .java,.class,$(wildcard *.java))
# this target entry builds the Average class
# the Average.class file is dependent on the Average.java file
# and the rule associated with this entry gives the command to create it
#
%.class : %.java
$(JCC) $(JFLAGS) $<
# To start over from scratch, type 'make clean'.
# Removes all .class files, so that the next make rebuilds them
#
clean:
$(RM) *.class
Those indentations are true tab characters. Ugh!
Give it a shot.