Wed Oct 14 08:01:19 CEST 2009

Crash course Java / Eclipse


* Installing in debian

It's probably safest to use sun's implementation, also for Fortress.

  apt-get install sun-java6-jdk

How to run the hello world program "hello.java"

import java.io.*;
public class hello {
    public static void main(String[] args) {

* To compile:

  javac hello.java

* To run, don't pass the extension (.class)

  java hello

The name of public classes should correspond to the file name
(filesystem -> class mapping).

* Getting class documentation.

Sun Java docs[1].

* Spartan build system, a Makefile:

.PHONY: clean all
all: hello.test

%.class: %.java
	javac $<

	rm -f *.class *~

%.test: %.class
	java `basename $< .class` $(TEST_ARGS)

* Eclipse

MOZILLA_FIVE_HOME=/usr/bin/firefox  eclipse

I'm giving up on the debian versions, they're full of bugs.
3.2 (lenny) and 3.4 (sid).

[1] http://java.sun.com/javase/reference/api.jsp