Ian Darwin: Java and the Meaning of Life

A Simplified, Rambling Overview

Java Logo

Java is a portable object-oriented computing language. Java was invented and released for everybody to use for free by Sun Microsystems, the Unix and networking company (NASDAQ: JAVA, formerly SUNW). Sun was acquired by Oracle some years back, and Oracle continues to support and enhance Java. BTW, it's Java, not JAVA - the name is a reference to the caffeine-rich drink, not an acronym (not even for Just Another Vague Acronym :-)).

One of Java's main benefits is portability; compiled Java programs do not have to be re-compiled to run on different platforms.

Ian F. Darwin, author of this site, is a Sun Certified Java Programmer and the original author of two courses on Java. Learning Tree Course 471, Java Programming Hands-On, provides a good introduction to the Java language and environment. His book The Java Cookbook provides an excellent second resource on Java. After you've learned the basics, get this book to learn your way around the many things you can do with Java.

Java Development

Programs are created by software developers in the Java Programming Language, possibly using a Java-specific visual development environment (IDE) analogous to Visual Basic. Java IDE's include Eclipse (originally from IBM), IntelliJ IDEa, NetBeans (now maintained by the Apached Software Foundation), and others.

Not all programmers like working in an IDE, though; you can program directly in Java using a graphical editor. The main command-line environments is Sun's Java Development Kit (JDK), also called the Java Standard Edition (JavaSE).

HTML and the Web

HTML is an older (1990) texting language that is used to develop Web pages. By a "texting" language I mean a language that is stored in plain text on disk, like, for example, an autoexec.bat file - you can edit an HTML file with any plain text editor (e.g., "notepad" on MS-Windows), rather than being locked into a single vendor's closed undocumented proprietary format (like Microsoft Word, Word Perfect, etc). UNIX users can use vi or emacs, and there are special-purpose tools from many vendors and in open source. Netscape Composer's ("Edit Page") feature, Microsoft FrontPage, Adobe PageMill, all generate HTML.

Applets

One of the big pushes earlier on with Java was that web pages can be enhanced through "Applets" which can be imbedded in HTML pages. An Applet is a small, self-contained software component written in Java. An Applet can can do almost anything: generate graphics, prompt for information and process it, and can contain a full GUI interface inside a Web page.

This was a significant change in the Web which before Java was entirely server-based. Java is the client-side processing capability that made the Web truly client-server for the first time. Other technologies such as ActiveX and Browser Plug-ins came later and offer certain features but include a vendor and platform lock-in which Java does not. Over the years, however, the web dev community have moved away from Applets, and they are no longer recommended or even supported.

Servlets

A servlet is a small program that can be loaded into a Web Server to generate server-side dynamic content and return it as a completed file to the browser. This enhances performance and gets away from the browser peculiarities that once plagued Applets. The servlet can generate HTML, but can also generate XML, Acrobat PDF, graphics images, etc.

There are also JavaServer Pages and the newer JavaServer Faces, which run like servlets but are much easier to write - the main language is HTML, with bits of Java sprinkled in. Servlets and JSP are covered in Learning Tree Course 570; JSF in Learning Tree 936.

Note that most developers building Java-powered web sites use a "framework" like Struts 2, Spring or Seam in addition to JSP/JSF to get more work done more quickly.

There are half a dozen compete web servers writtin in Java, including Tomcat, Netty, Jetty, JBoss Wildfly, and more.

Jakarta Enterprise (formerly The Java Enterprise Edition, Java EE, J2EE)

Jakarta Enterprise - The Java EE (Java Enterprise Edition) - is an umbrella standard for all of Java's server-side APIs. Java EE is currently the dominant server-side development framework.

Some of the main parts of the Enterprise Edition are:

There are Java EE Servers from many vendors; these are invariably written (almost) entirely in Java.

Not Just Another Pretty Page

It's important to note that Java can be used as a programming language just like C and C++ for many of the same applications that a developer would use C or C++. That is, either desktop apps, enterprise apps, or even mobile apps. There are many, many Java API's available for programmers, including JDBC (replacing ODBC), networking, local files, windowing, etc -- almost anything you could do in C/C++, except maybe device drivers for MS-Windows or UNIX, could be done in Java.

Why Java?

Why would a programmer use Java? It is portable -- Java Programs need only be compiled once, and can run on almost any computer (UNIX, Mac, or PC with Windows). At present a Java interpreter is needed if you want to run Applications. However, Java now includes the ability to either bundle a minimal Java Runtime (JRE) and even to build a native application.

Java is also a fairly pleasant language to learn, with many features that contribute to reliability:

There are many more - take 471 for more information!

Java is not JavaScript

Please also note that Java is not JavaScript.

JavaScript is NetScape's HTML scripting language. It was originally called LiveScript, but was renamed JavaScript in the initial excitement of Java. This may be a big issue because JavaScript has some security problems.

Executive Summary So Far

Java is used to write many kinds of programs, including servlets/JSP and EJBs which run on the server side, and is a good all-round programming language.

Why Not Java? Security?

If anyone mentions the security issues of Java, make sure they are not confusing it with JavaScript, which has many more security issues than Java. Particularly when combined with an insecure browser like Microsoft Explorer (do a Google search on "microsoft+explorer+script" to see how bad it is - Explorer will go down in history as the IIS of browsers).

Java for use with regular applications (including web servlets and JSP) is as secure as C, C++, Ada, etc., and also generally more reliable.

Java and ActiveX

ActiveX is Microsoft's Component Object Model. ActiveX is not a programming language. Java is a programming language. Therefore you can't compare them.

ActiveX compares to one of the many Java APIs, notably Java Beans. Beans is Sun's Component Object Model for Java. Both Beans and ActiveX have their place, but Beans is far more cross-platform. As well, there are real security problems with ActiveX, since it lets you download arbitrary machine code rather than carefully-controlled Java Byte Codes.

It seems safe to conclude that Java is here to stay.