I am trying to compile with javac on Snow Leopard through the command line. I have Xcode installed. I am just using a simple Hello World file, it works in Eclipse but I can't get it to work using javac.
javac -version returns javac 1.6.0_17
HelloWorld.java
public class HelloWorld
{
public static void main(String[] args)
{
String message = "Welcome to Java!";
System.out.println(message);
}
}
I type: javac HelloWorld.java
and get the following error.
HelloWorld.java:1: class, interface, or enum expected
public class HelloWorld
^
1 error
and...
javac -cp . HelloWorld.java
returns the same.
echo $CLASSPATH just returns blank.
Thanks for the help.