Re: eMac
Jean Pierre Daviau wrote:
Hi everyone,
Beside using java webstart, how do you start a simple 'Hello World'
application on a e Mac.
----
class
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
First suggestion:
Write code that you can compile with the 'javac' command (or from within your
IDE). The code you presented will not compile.
Then:
Let us suppose you name your class 'HelloWorld' and that you place the source
code in subdirectory 'example' of your project source directory:
~/learning/src/ $ mkdir example
~/learning/src/ $ emacs example/HelloWorld.java
....
~/learning/src/ $ javac example/HelloWorld.java
Assuming you got no errors from the compilation, you can now run the resulting
program:
~/learning/src/ $ java -cp . example.HelloWorld
Naturally, your source must declare the correct package and name the class, as
well as making it public:
/* HelloWorld.java
*/
package example;
public class HelloWorld
{
...
}
Take a gander at Bruce Eckel's book _Thinking in Java_, available in free
online versions, and the abundant tutorials on the Sun Java sites.
- Lew