Java is a big topic by itself, so I'm not going to get into much of the
details here.
The ideas behind the Java:
'Write once, run anywhere' - Java programs are not compiled
into machine code, they are converted into a bytecode format, which is
architecture independent. The way it is working, is that the bytecode file is
executed on Java Virtual machine (VM). VM is running on actual physical
machine.
It should allow to write more robust applications, because programmer
doesn't need to take care of the memory management. Java have a garbage
collection, which should help to avoid memory leaks. So instead of
freeing the memory, you can just 'forget' about it and garbage collection
will take care of it somewhen...
Java is a programming language, so it can be used to write any programs. In
the Web development it can be used in a different ways:
Client-Side (applets) - If Web browser has a Java VM (most
of them do), you can run Java applet on it. Applet is written in Java with
some restrictions, like it can't access the files, run the system commands
etc. It's done mostly because of security. Applets are working in the
following way:
HTML page has an <APPLET> tag, which points to the source where
to take the applet from.
Browser brings the applet over the Internet (since it can be pretty big,
it can take some time)
Browser runs the applet on it's JVM
Server-Side Java applications (Servlets) - Java
applications, which are working on Web server / application server side.
Basically CGI programs written in Java.
Java Server Pages - This is the new technology in
application servers, which allows to embed the Java code to be executed
on the server, into HTML pages. For more on this look
here.
Summary (Applicable mostly for the Client-Side Java):
Pluses:
Java allows you to write an application, put it on your Web site and let
people use it...
Allows to do graphic applications, which is hard to do with JavaScript.
Minuses:
Very slow. Because of the downloads, but even more because it's running
inside the virtual machine and it's slow and because of the garbage
collector.
Have a security problems because of VM implementations.
Uses a lot of memory (garbage collector & VM implementations).
'Write once, run anywhere' is not always a reality because VM
is implemented differently on different platforms (Netscape, IE).