You have a misunderstanding of Java. It is not compiled for each VM.
It is compiled and then each VM converts it into the machine code for that specific machine.
So when you compile a java program into a class file, you can run it on a windows machine, put on a linux box and run it just the same.
So with an applet in your question, as long as the browser viewing it has a Java VM, your code will work fine.
> So the bytecode (class files) are also machine
> independent?
Yes.
> When i recently bought a Mac (switched from windoze)
> i recompiled all my source code - was this unecessary?
No.
This has some neat diagrams that you might like:
http://java.sun.com/docs/books/tutorial/getStarted/intro/definition.html