Can't get Javac to work on Mac OS X
Posted
by elguapo-85
on Stack Overflow
See other posts from Stack Overflow
or by elguapo-85
Published on 2010-05-03T16:18:06Z
Indexed on
2010/05/03
17:58 UTC
Read the original article
Hit count: 270
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.
© Stack Overflow or respective owner