HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML

In December 1995, Bill Gates mobilized his company into a war to dominate the Internet. Every product would now require an Internet strategy. Also, Microsoft would "embrace and extend", especially in regard to the threat of Sun's Java. To this end, Microsoft developed Visual J++, which allows you not only to create pure Java programs ("embrace"), but also to develop programs that use the Common Object Model ("extend").

The minimum installation is 14 MB and the full-blown system is 40 MB. You will also need at least a 486 running Win95 or Windows NT 4.0. Win95 will need a minimum of 8 MB of RAM (12 MB recommended); Windows NT 4.0 will need 16 MB of RAM (20 MB recommended).

I had no problems with the installation. However, according to the Microsoft Web site (http://www.microsoft.com/visualj/), the installation has two main problems:

  1. Win95 requires a protected-mode CD-ROM driver to access Visual J++.
  2. If you already have a current version of Internet Explorer on your system and you do not reinstall it, the classes.zip file will not be extracted. Fortunately, there are workarounds for these problems on the Microsoft Web site.
The IDE, which is based on the Developer Studio of MS Visual C++ 4.0, has three main windows:

The Project Workspace Window: Here, you can select three tabs -- ClassView, FileView and InfoView. ClassView is a graphical tree of all the classes in your project. Below each class are the methods and variables. Icons next to the classes indicate whether they are public, private or static. By right-clicking, you will bring up dialog boxes to add methods, variables, new classes and breakpoints. The FileView shows a listing of all the files in your project. By right-clicking a file, you can see its properties, such as the dependencies on other files. Finally, InfoView is the table of contents for the complete documentation for Visual J++.

Figure 1

Application Window: The contents of this window depend on the context. For instance, if you select a topic from the InfoView documentation, this will appear in the Application Window. If you select a class, the code will appear.

When creating code in the Application Window, you have a full set of editing features. Keywords, comments and operators have their own color. This makes your code easier to read. Right-clicking will activate a pop-up box that will allow a variety of options, such as cut/paste, the setting of breakpoints, etc.

Other features include: bookmarks, which are used to flag areas you want to return to; customizable toolbars and menus, and an image editor. One especially cool feature is DataTips. If you hold the cursor over a variable, the value will appear.

Output Window: This is, by default, at the bottom of the screen and shows the results of different operations, such as Debug, Find in Files, etc. The messages in the Output Window are also hypertexted. So, if you debug your program and you have several errors, you merely click the message and you will be taken to the specific location of the error.

You can use the Applet Wizard to create the overall structure of your program. A series of dialog boxes will query you for information about whether you want an HTML file created for the applet, whether you want support for multi-threading or animiation, whether you want explanatory comments and whether you want support for certain mouse events. You then press Finish and Visual J++ creates the necessary Java code and files to begin your project.

Constructing a graphical user interface (GUI) using the Abstract Windowing Toolkit (AWT) is time consuming. Visual J++ has several tools to increase your productivity. Unfortunately, compared to other IDEs, such as Symantec's Visual Cafe, Visual J++'s solution is cumbersome. For example, in Visual Cafe you can drag-and-drop components onto a form and the Java code is automatically generated.

As for Visual J++, you need to create resource files, of which you have a choice of several templates such as Toolbar, Menu and Dialog. Suppose you select Dialog. You can then drag-and-drop components - text boxes, labels, and so on - onto the Dialog. If you double-click a component, you will see a properties sheet, where you can change such characteristics as fonts, colors, style, etc. Next, you use the Resource Wizard to convert the resource file into a Java class. You will then need to manually enter code to make the GUI appear. Furthermore, to make the Dialog work you will need to distribute the DialogLayout class with your code.

Visual J++'s visual integrated debugger has all the features you need. With a mere right-click, you can set a breakpoint and even a conditional breakpoint. A conditional breakpoint is activated when a condition is met, such as i > 100.

You can set up a Watch Window, which will show a list of the variables you want to track. You can drag-and-drop variables into this Window and even modify the variables on the fly. The Variables Window has a tree-outline of all the active variables. If you right-click the variable name and select Properties, you will see the type, name and value of the current variable. The Call Stack Window shows the most recently used active method calls - displaying the data types and actual values of the parameters passed to methods. This makes debugging much easier when you have overridden methods of a superclass.

If you do Windows development, then you will like Visual J++'s ability to integrate Java and the Common Object Model (COM). Basically, COM is a framework which allowing objects written in any language to exchange information. However, COM works only on the Windows/NT platform. Microsoft has developed objects known as ActiveX controls, which are built for the Internet and use the COM framework. There are thousands of these controls -- such as spreadsheets, spell checkers, word processors--that can add tremendous functionality to your Web applications.

The Microsoft Java Virtual Machine can load COM objects and then expose the interfaces. That is, COM can be used in Java code. In fact, Java classes can be exposed as COM objects. Thus, you can call and use these components in other environments, such as C++ or Visual Basic.

You can import any ActiveX control or component into your Java project by using the import command. If you are creating your own COM object, you will first need to create a GUID (Global Unique Identifier) for each interface and COM object. Next, you will use the Type Library Wizard to make the necessary .class files for the component and its interfaces. A summary.txt file is created, which has the signatures for each method in the class. Then you will register the control in the Windows Registry. It is only a matter of instantiating the COM object to activate it in your Java project.

The documentation is primarily online. It is thorough and has many example applets. Also, Visual J++ comes with a good introductory book by Stephen R. Davis, which is called Learn Java Now. But the book does not discuss COM.

Even though its GUI builder pales in comparison to Visual Cafe, Visual J++ is still the best tool (and, really, the only tool) for integrating COM. Moreover, if you already program in MS C++ 4.0, Visual J++ will be much easier to learn--since the IDE is identical. And, considering the professional version of Visual J++ costs only $99, you can't go wrong using this product.

About the Author
Tom Taulli is the CEO of Blueprint Interactive (www.bpia.com), which develops Internet applications for the enterprise. He can be reached at [email protected]


All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.