DBMS

Visual J++

By Kevin Reichard
DBMS, August 1998
  • Microsoft Corp., Redmond, WA; 800-426-9400, 425-882-8080; www.microsoft.com.
  • System Requirements: Microsoft Windows 95, Windows 98, or Windows NT 4.0 (with NT4 Service Pack 3); Microsoft Internet Explorer 4.01 or greater; 90MHz or better Pentium processor; 24MB of RAM (32MB of RAM recommended); 83MB of hard disk space to run Visual J++ 6.0 and to store the documentation (150MB of hard disk space needed for installation).
  • Pricing: To be determined. You can download previews from www.microsoft.com/sitebuilder/visualj/visualjcd.asp
Visual J++ 6.0 is a Java development tool that directs support for the Windows API, most notably through support of Component Object Model (COM) objects and the Windows Foundation Classes (WFC) for Java.

Microsoft knows Windows, so it shouldn't come as a surprise that a Microsoft-developed tool would be geared toward the Windows environment. In fact, the main focus of Visual J++ 6.0 is the development of Java applications for the Windows environment. This contradicts one of Java's main strengths: In theory, you can create Java applets and then run them in a number of different environments, including Unix and Macintosh. But it also buys into one of the realities of Java development - most of you will be crafting solutions for a single operating system.

Whether or not this is a good thing depends on your needs as well as on your feelings in general toward Microsoft. The company claims the Microsoft Developer Tracking Study reveals that more than 50 percent of Java development solutions were for a single operating system and 90 percent of all Java development takes place in a Windows environment. Because the most pervasive end-user environment out there is Windows in some form or another (Windows 95, Windows 98, and Windows NT), it makes perfect sense that Microsoft would skew Visual J++ 6.0 heavily in favor of Windows. If you have to support other operating systems, you can use Visual J++ to create OS-independent code.

It's a Windows World

Visual J++ has direct support for the Windows API, most notably through support of COM objects and the WFC for Java. These object-oriented Java class libraries unify the Win32 API and Web-development schemes (specifically, HTML and dynamic HTML) with a single programming model. An application should not be limited by where it runs. It should run consistently, whether it's on a desktop, within a browser, or on a server.

The other advantage to WFC is that you can create full-featured applications from outside the traditional confines of Java development. Let's face it; as a programming language, Java leaves some things to be desired, and it would be useful to add the good things in Java to a more robust environment.

Of course, Microsoft being Microsoft, some functionality of Visual J++ 6.0 derives from a set of Microsoft tools. Take, for example, dynamic HTML and the WFC. The Web server (guess whose) runs the WFC classes, which generate Dynamic HTML pages to Internet Explorer 4.0 or any other Web browser supporting Microsoft's Document Object Model - as opposed to Netscape's Document Object Model, of course. The end results are Java-based Windows applications that can hook into Windows-system services, taking full advantage of Microsoft tools such as ActiveX and COM components.

If you don't desire any Windows hooks, Microsoft also offers the ability to generate straight Java code from within Visual J++. I did this and tested the code in some non-Windows environments, and the Java programs worked just fine. But will you use Visual J++ to create straight Java code? Probably not; there are cheaper and more flexible programming tools that will do this, and you'd be wasting a lot of money to use a small portion of the Visual J++ functionality. If you're looking to generate straight Java code, Visual J++ 6.0 isn't for you.

Options Galore

I looked at Technology Preview 1 of Visual J++ 6.0. There were the usual problems associated with prerelease software: frequent crashes, some sluggish performance, some problems in consistency, and some features that were not yet implemented. Microsoft makes Technology Preview 1 available free of charge at its Web site (www.microsoft.com/sitebuilder/visualj/vjget.asp) or via CD-ROM, and it doesn't expire until the end of November. The Technology Preview was a tease, showing Visual J++'s potential in a tantalizing fashion. Because the download is 36MB, you might want to pay $7.50 for the CD-ROM.

That doesn't mean that Visual J++ doesn't offer a lot of other good reasons for purchase, especially those of us creating Windows end-user applications. Component development is perhaps the biggest reason to adopt Visual J++ if you're not necessarily a Java devotee. When you create a component using WFC, you can easily change it depending on your needs. You can install it on the tool palette and drag and drop it into an application or another component when you need to. You can change Java classes into COM objects to work outside of a Java environment. In other words, you can create one application and change its parameters based on where you anticipate it will run.

Otherwise, the extent of Windows support in a platform-neutral environment is quite impressive. The J/Direct API is a part of WFC and allows access to all Win32-based APIs. Basically, J/Direct is a method for directly accessing dynamic link library (DLL) files from Java. This also includes a full set of classes for the Windows user interface (list boxes, toolbars, and so on), and you can combine these elements with HTML and Dynamic HTML user-interface elements as well as add relatively mundane but useful touches such as user accelerator keys. It's the ultimate in hybrid applications. Other Microsoft extensions to Java include conditional compilation flags and approaches resembling function pointers.

The J/Direct API also allows some things that are strictly verboten in a pure Java environment, however. In theory, you should download Java applets to the client and run them in a safe space - that is, without access to local resources like the hard disk. However, the J/Direct API provides extensive access to the client's PC, and while Microsoft has done a good job providing security controls with its implementation of Java on Windows, the fact remains that Visual J++ inverts the Java programming model to let server-side Java applications extensively access resources on the client. If you're coming from a client/server environment, you probably think this is a good thing because it allows for some powerful applications controlled on the server.

Appealing to Database Professionals?

Database professionals will be especially interested in the WFC data access classes. Other database management vendors have picked up on the cue and announced support for these classes. Sybase, for instance, is including support for these classes in PowerJ, its own Java development environment. In addition, you can develop your own ActiveX controls with ActiveX Data Objects 2.0 for data access. The beauty of this approach is that you can recycle objects outside the Java environment.

Of course, this being a Microsoft application, it has wizards that simplify routine tasks. For instance, the Application Wizard guides you through the creation of a standard data access application connected to Microsoft Access or any ODBC database. (See Figure 1.) After you have specified the database, you can choose which tables and records to access, along with whatever controls you want to work on the data. The entire process of creating a down-and-dirty data access application took relatively little time, and I could have easily spiffed up my application with controls. If I had been working with SQL, I could have used a SQL Query Designer to create complex SQL statements for any database with drag-and-drop tools.

Database professionals should be interested in how Visual J++ 6.0 integrates with Visual Studio (which is the envisioned environment for Visual J++ in the enterprise). In these circumstances, Visual J++ gives you access to advanced database features, such as the ability to design and modify database tables and schemas and to edit and debug stored procedures. In addition, there are relatively easy hooks to other BackOffice servers, including SQL Server 6.5, Internet Information Server 4.0, and Microsoft Transaction Server 2.0.

As part of Visual Studio, Visual J++ 6.0 gives you direct access to the Microsoft Visual Database Tools, including Data View, which connects to and explores any ODBC or OLE DB database (with specific support for Oracle and Microsoft SQL Server). A SQL Database Designer provides the ability to create and modify Microsoft SQL Server databases, including individual tables as well as entire database schemas, a Stored Procedure Editor with which you can create and edit Microsoft SQL Server stored procedures using a color-coded editor, and a Stored Procedure Debugging tool that remotely debugs stored procedures on Microsoft SQL Server 6.5 databases.

Easier to Use

Visual J++ 6.0 is simply easier to use than competing tools. Microsoft has overhauled the interface, making it conform to the Visual Basic 5.0 integrated development environment; it has also pulled in elements from Microsoft Word 97 and Visual Studio 97. Most notable is the Microsoft IntelliSense technology, designed to anticipate your next mode with on-the-fly syntax checking, method name completion, and method parameter list information. The debugger is also a vast improvement over the debugger found in the original versions of Visual J++. And when you make mistakes in your code (such as errors that prevent compilation), Visual J++ underlines them in red (just like in Word).

The interface also provides for a dual-view feature, where you can view both the visual designer and a code window simultaneously. When you're working with the virtual designer, the code window prevents access to the code in use; when you want to access the code directly, the visual designer stays open. Also notable in the interface is Tab Link, where you can tie together multiple windows in a tabbed layout.

It's now easier to create forms using the form designer, which Microsoft clearly adapted from Visual Basic. You access forms information via a Properties window, from which you can edit forms or add event code.

Have Your Cake and Eat It Too

Visual J++ 6.0 is a great tool for creating Windows applications. It may seem at times that Java has been downplayed in Visual J++ 6.0 in favor of the WFC framework, and Microsoft is certainly not following Sun's wishes in the ongoing development of Java as a programming environment. (Then again, who is?) And for conspiracy theorists who view Microsoft as an evil harbinger of an impending apocalypse, Visual J++ 6.0 can certainly be seen as an attempt by Microsoft to co-opt an open programming environment in favor of the closed and semiproprietary Windows environment.

Java politics aside, most of us work in a Windows environment on some level and create applications for Windows users, and a tool like Visual J++ 6.0 can only help enhance productivity. By providing the ability to create server-side Java applications with a lot of control over the Win32 API, as well as generating clean Java code without any of the Windows hooks, Visual J++ 6.0 lets you have your cake and eat it too.



Figure 1. The Application Wizard guides you through the creation of a standard data access application.


Kevin Reichard has written 17 books for MIS:Press/M&T Books. You can visit his Web site at www.kreichard.com.
What did you think of this article? Send a letter to the editor.


Subscribe to DBMS -- It's free for qualified readers in the United States
August 1998 Table of Contents | Other Contents | Article Index | Search | Site Index | Home

DBMS (http://www.dbmsmag.com)
Copyright © 1998 Miller Freeman, Inc. ALL RIGHTS RESERVED
Redistribution without permission is prohibited.
Please send questions or comments to dbms@mfi.com
Updated July 7, 1998.