FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Java
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
August 17, 2004
Java Newsletter - August 2004

Al Williams
Keeping up with the latest in Java development tools and APIs is a full time job these days. Luckily, Dr. Dobb's Java Newsletter is here to do the work for you. Edited by Java expert Al Williams, Dr. Dobb's Java Newsletter covers all the Java news that's fit to print, including API revisions and releases, commercial and open-source development tools, Java tech tips, and more.
Dr. Dobb's Java Newsletter - 8/11/04

Issue #14
August 2004

By Al Williams

You probably know that I live in South Texas, and the summer is in full swing here. As I’m writing this, I can see the top globe of my Galileo thermometer sinking lazily to the bottom where the other bubbles are already huddled (I really should close my blinds in the afternoon).

Any very hot (or very cold) day reminds me that it is the opposite season in the southern hemisphere. My friends in Australia sun on the beach at Christmas and are having cool spells in the middle of our summer here in Texas.

This is sort of a meteorological yin/yang. Perhaps it is a sort of conservation of weather. After all, momentum, energy, and mass are all conserved. I’ve often thought that luck is probably conserved too (good fortune usually seems to be at someone else’s expense). So why shouldn’t weather be conserved as well?

I think several quantities in software development are also conserved. Everyone knows you can write code that is small or code that is fast, but you usually can’t do both at the same time. Total time spent in meetings seems to be inversely proportional with quantity of code produced.

Thinking about duality is often an interesting way to get some perspective on something familiar. What are the dual parts of Java? Most people would agree that Java programmers enjoy portability, code security, and an extensive library (I’m always particularly impressed with the library’s networking abilities). So what is conserved?

There are a few downsides to Java. Safe code means less flexibility with techniques like pointers. Many people call this a good thing (just as I think a warm New Year’s day would be pleasant). The JVM itself is also a cost inherent in Java’s features. After all, the JVM provides portability and security, but it also hides important details about memory allocation and other system utilization. Besides, the JVM is often a performance bottleneck.

That’s not to say that the benefits don’t outweigh the problems. Besides, just as it is warm in the north while it is cold in the south, other languages have other strengths and weaknesses. C is versatile, but it isn’t as portable and certainly not as safe. It also doesn’t enjoy the standard library support that is one of Java’s strongest points. Perl, Visual Basic, and Fortran all have various strengths and weaknesses.

With so much emphasis lately on the future of Java standards (especially the move to open source Java), it pays to stand back and look at where we would like Java to go in the future. No matter how much you love Java (or whatever your pet language is), I have little doubt that there is room for improvement. A different perspective is often useful to determine future directions for growth.

My fear? Endless squabbling over Java’s feature set will allow someone else to provide the tools developers need. Unix vendors squabbled over the operating system market and provided Microsoft with an opportunity to gain vital footholds. If C standards had addressed portability, networking, and code safety, Java may have found fewer developers ready to switch.

So my question to you is where do you want Java to go? Do we need simpler development tools? Do we want more ability to manipulate native environments at the expense of portability? How important is JVM speed? Drop me a line with your thoughts.

 

Speaking of Native Environments…
Just like Americans expect everyone to speak English, Windows users expect programs to behave certain ways. This is often problematic with Java programs since few of us want to hack around the Windows API in Java to do things like manipulate network settings or install a tray icon. If you want Windows-like behavior but don’t want to get your hands dirty in the Windows API, have a look at javaapis.com. They recently announced classes that manipulate Windows networking to complement their existing interfaces to the Windows system tray, IE, and Flash. Not inexpensive, but I suspect it is relatively cheap compared to the amount of effort it would take to duplicate.

And Speaking of Windows…
Sun recently announced that in the first quarter of 2005, Java Enterprise System will support Microsoft Windows for x86-based hardware (including AMD Opteron systems), and HP-UX on the PA-RISC architecture. This is, of course, in addition to the current support for Solaris, SPARC, and Linux.

Java’s Red Hat
Red Hat–the company famous for its Linux distribution–announced its new Java platform, the Red Hat Application Server, at Linux World. Red Hat Application Server will be sold on a subscription basis with services and support, in a similar pricing model to that which Red Hat uses for its Linux OS.

The software is based on JOnAS (Java Open Application Server), an open source application server developed by ObjectWeb. It also incorporates the Apache Tomcat Java servlet engine and Struts.

Meanwhile, the Geronimo project (Apache’s Java Application Server) announced it will miss its August 6th target for a certified release, but expect to complete certification later in the quarter.

Beehive
BEA Systems announced it’s signed on four organizations (Red Hat, HP, JOnAS, and Geronimo) that plan to incorporate BEA’s Beehive Java development software (which is already an Apache Open Source project; see incubator.apache.org/projects/beehive.html). Beehive provides a simple visual way to write cross-container applications (see dev2dev.bea.com/technologies/beehive/index.jsp).

The Business View
I’m used to thinking about companies in technical terms, and I don’t spend much time thinking about the business side of them. Jim Kerstetter and Peter Burrows of Business Week do think in business terms. An article published last month businessweek.com/magazine/content/04_30/b3893001_mz001.htm accuses Scott McNealy of destroying Sun by refusing to accept the changing realities after the dot-com boom ended. According to Kerstetter and Burrows, McNealy’s refusal to cut costs or develop low-cost products has brought Sun’s revenues down 48 per cent in 3 years and cost it one-third of its market valuation.

The article mentions that McNealy’s management team (including Edward Zander and Bill Joy) recommended cost cutting measures, but were overruled. The editorial ends by calling McNealy’s turnaround of Sun “a longshot.”

Tech Talk: Compiling On the Fly
Last month I mentioned JVM assembly language as a way to construct items on the fly. Did you know that the Java compiler is actually in the com.sun.tools namespace and is callable from your program? No kidding!

Just be sure that tools.jar is in your CLASSPATH, and you can actually instantiate the Java compiler and execute it. For example, suppose you want to allow a user to write a mathematical equation and evaluate it. Here’s a user’s session with the proposed program:

$ java onfly
Enter equation:
Math.cos(x*x)+10
Enter X:
1.2
Result is 10.130423595274738


Here’s a simple program that does the job:

// Compile an equation on the fly
        import java.io.*;
      
        class onfly
        {
        
        // This actually compiles our class
        // Note that we have to have a "dummy" class for 
        // our initial compile
        public static int compileeqn()
        {
        com.sun.tools.javac.Main javac = new com.sun.tools.javac.Main();
        String [] args= new String []
        {
        "-d", 
        System.getProperty("user.dir"),
        "-nowarn",
        "onflyeqn.java"
        };
        return javac.compile(args);
        }
    	 // Call the compiled class 
        public static void action(double x) throws Exception
        {
        onflyeqn eqn=new onflyeqn(); // create class we compiled
        System.out.println("Result is " + eqn.f(x));
        }
        // Ask the user for f(x) and x
        public static void main(String [] args) throws Exception
        {
        String eqn;
        double x;
        FileWriter fw=new FileWriter("onflyeqn.java");
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter equation: ");
        eqn=br.readLine();
        // Write onflyeqn.java
        fw.write("class onflyeqn {\n");
        fw.write("public static double f(double x) throws Exception {\n");
        fw.write(" return ");
        fw.write(eqn);
        fw.write(";\n }\n}");
        fw.close();
        // Compile the code
        compileeqn();
        // could check return code here!
        // Read X (reuse eqn since we don't need it anymore)
        System.out.println("Enter X: ");
        eqn=br.readLine();
        x=Float.parseFloat(eqn);
        // Run the code
        action(x);
        }
        }

The code reads an equation and builds the file onflyeqn.java that looks like this:

class onflyeqn {
        public static double f(double x) throws Exception {
        return Math.cos(x*x)+10;
        } 
        }

You actually need a dummy version of onflyeqn to satisfy the compiler that the class exists when you first compile your code.

The compiler’s Main method takes the usual command line argument array, so you already know how to invoke the compiler. Once the compiler completes (you get an error return code so you can tell if the compile worked or not) you can call the new object in the usual way.

JBoss Server Passes J2EE Compatibility Tests
By Elizabeth Montalbano

JBoss announced that it is the first company to support a fully J2EE-compatible application server.

The professional open-source firm plans to announce that the JBoss Java application server passed all of the tests that make up the J2EE Compatibility Test Suite from Sun Microsystems. In a press statement, executives from JBoss, based in Atlanta, stated the company also will release an early version of JBoss 4.0 Java application server, which is J2EE compatible, with a final release to follow later this year.

"Enterprise customers now have a J2EE-compatible open-source alternative backed up with superior services from JBoss Inc. to deliver the highest level of quality and reliability for achieving their business objectives," JBoss CEO Marc Fleury said in a press statement.

The news comes as little surprise. At JavaOne in late June, Fleury told CRN that testing of the application server was almost complete. Still, the presence of fully certified J2EE open-source software in the market could prove troublesome for proprietary J2EE software vendors such as BEA Systems and IBM, especially since Sun Microsystems also is pondering whether to open-source some of its own Java software (see story). Through Project Geronimo, the Apache Software Group also is readying a fully J2EE-certified, open-source application for release in August.

The JBoss application server already has increased market pressure on proprietary Java software vendors, and analysts believe this likely will continue as customers consider open-source alternatives to traditional proprietary software. "Frankly, the entire industry is moving toward this," said James Governor, principal analyst with London-based think tank Red Monk. "Everyone is going to be buying a combination of open-source and proprietary software." In addition to the JBoss application server, JBoss also supports an open-source portal, and has future plans to release, either through in-house development or through acquisition, open-source business process management (BPM) and workflow software, Fleury said at JavaOne.

One likely candidate for acquisition is BPM software provider Oak Grove Systems. Oak Grove and JBoss have been quietly forging stronger ties lately, and at JavaOne Fleury hinted to CRN that JBoss may purchase Oak Grove. However, no deal has been reached. [Source: CRN]

Coming Up in DDJ
Java coverage in the October issue of Dr. Dobb’s Journal:
- Autonomic Delivery of Expertise Via Web Services: The Agent Building and Learning Environment is a complete environment for designing, testing, and implementing Java-based artificial intelligence agents.

- The Eclipse Visual Editor for Java: The Eclipse Visual Editor for Java is a plug-in for, well, visual editing.

- Refactoring with Eclipse: Eclipse provides a collection of refactoring features.

- Eclipse 3.0's Rich Client Platform: Eclipse 3.0's Rich Client Platform takes the drudgery out of writing SWT-based applications.

In Closing
So what is the best future direction for Java? If Java doesn’t go open source, will you look for open source tools to replace it? Will you stick to Java, or will you search for a tool that is not plagued by vendor strife? What are the other options, in your opinion? Drop me a line at alw@al-williams.com and let me know your thoughts. See you next month!

TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK