Read an Excerpt
Java is a product of Sun Microsystems. These are some Web sites that contain Java resources online, most of them at Sun:
- http://developer.netscape.com/tech/Java/. Netscape's "Java Developer Central" site, which contains a good amount of useful information
- http://java.sun.com.The main Java site; it's filled with information
- http://java.sun.com/docs/.Java documentation available online; this is the reference Web site.
- http://java.sun.com/jsee/. The site for the current Java software development kit (this URL is very subject to change).
- http://java.sun.com/j2se/1.3/.The home of JavaVersion 1.3,which is the current version as of this writing (actually called Java 2 Platform, Standard Edition, version 1.3), of the Java software development kit
- www.javaworld.com. A great number of Java resources and discussions
Here's another list that you might want to look into; these are free online tutorials that you can use to develop your Java skills:
- http://Java.sun.com/docs/books/tutorial/index.html.Sun's own, very extensive Java tutorial
- http://gamelan.earthweb.com/javaprogramming/javanotes/. Gamelan's Java tutorial
- www.javacoffeebreak.com. A good online Java tutorial
- www-4.ibm.com/software/developer/education/buildapplet/. IBM's Java tutorial with some outstanding features
Here's an important note Java programming is not for everyone. Java is a complex language, and to cover it fully would take thousands of pages. We can't ignore it because it has come to play such a big part in the XML world, but if you're not into programming, you can skip the Java chapters (this and the next two chapters) and continue on with the rest of the book. Many people prefer to get their Java XML applications written by someone else, and that's fine. However, these days, to really work with XML, it usually comes down sooner or later to working with Java.
Writing Java Programs
You're probably already familiar with Java, if only because of Java applets. Applets-windowed Java applications designed to work in browsers-took the world by storm when first introduced, and all major browsers support some version of Java these days. You can find millions of applets on the Internet, and you can pick up whole banks of them for free. There are even applets out there that work with XML.
A Java applet takes up a predefined area in a browser and can display graphics, controls (such as buttons and text fields), text, and more. It's interactive because it runs in your browser. As mentioned, applets took the Internet by storm when first introduced. However, they're on the wane now, largely because of other solutions that can be easier to program, such as Dynamic HTML, or more powerful, such as Shockwave.
Don't worry about Java though-as applets have become less popular (although still very popular), Java applications have gathered strength. The main reason that Java applications have become so powerful is that they're nearly as powerful as C++, but they're also cross-platform-you can use the same application in Windows or UNIX, for example. Many large corporations have switched from using C++ internally to using Java for most programming.
A Java application does not run in a browser like an applet-it's a freestanding program. Java applications can themselves create windows, such as applets, and we'll see how to do that here. In fact, Java applications can act as browsers, and we'll see an example of that in the next chapter with a Java application that reads an XML document from the Internet and uses it to display graphics. In that case, the XML document will specify circles to draw, and we'll be creating a graphical, not text-based, browser, which is typical of the kinds of things you can do when you create your own XML applications...