Delphi Clinic C++Builder Gate Training & Consultancy Delphi Notes Weblog Dr.Bob's Webshop
Hubert Klein Ikkink (aka Mr.Haki) - Communications Officer
 Mr.Haki's JBuilder Jar #46
See Also: JBuilder Papers

Using JDK1.2.2 with JBuilder 3
Living in Java world is living in the fast world, because Sun has recently released a new JDK: JDK1.2.2. This is a newer JDK than used for JBuilder 3 when installed. In this week's tip we will see how to use the new JDK with JBuilder 3 for compiling Java applications and applets, but also for using JBuilder 3 itself. Because we enter a bit of unsupported area of JBuilder 3 tweaking we will encounter some small problems. One of them being the problem of not being able to start help anymore from within the IDE. This problem can be overcome, because we simple start the help from outside the IDE.
How do we do this? Stay tuned for next week's tip!

The JDK1.2.2 release is primarily a major bug fix for the Swing components. Sun has managed to solve 350(!) bugs and added a nice new feature: HTML Text in Components.
The following text is copied from the CHANGES.TXT file for the new Swing 1.1.1 included with the JDK1.2.2:

HTML Text in Components

Although this release is largely a bug fix update, it adds one
new feature of note: many components can now contain HTML text.
These components include instances of JButton and JLabel (whose
HTML support was added in Swing 1.1.1 Beta 1), JMenuItem, JMenu,
JCheckBoxMenuItem, JRadioButtonMenuItem, JTabbedPane, and
JToolTip (whose HTML support was added in Swing 1.1.1 Beta 2) --
but not yet JCheckBox or JRadioButton.

If the text property of an HTML-supporting component is a string that
begins with "<html>", the rest of the string is used to create a
lightweight HTML document and the text is rendered by the full
Swing styled-text engine.  For example, the following code creates
a JLabel that displays multiple lines of text in different fonts
and colors:

    String htmlText =
        "<html>A JLabel with <i>various <font color=blue>text styles<br>" +
        "And a new line!</font></i>";
    JLabel myLabel = new JLabel(htmlText);

Look for more information about this feature in The Java Tutorial, in
how-to pages such as the label page:

Wow!! So this means we can add HTML styled text to most of the Swing components. This solves issues like multi-line labels and tooltip texts and opens a lot of new possibilities. I think this new feature is nice enough to try using it with JBuilder 3.

Installing JDK1.2.2
First we must download the new JDK1.2.2 from Sun's website at Then we can install the JDK somewhere on our machine. Place it in another folder than the JBuilder 3 JDK found in the java folder in the JBuilder 3 folder structure.

Adding JDK1.2.2 to JBuilder 3
As we know JBuilder 3 supports JDK switching. So to be able to compile our applications and applets with the new JDK we must add the JDK to JBuilder 3. Follow these steps to achieve this:

Well, we are now able to compile our Java applications using the latest JDK version.

Using JDK1.2.2
Now let's see what this new Swing HTML feature does when we want to use it in JBuilder 3. We create a simple application to play around with the new HTML text features:

Changing the JIT compiler
When we run the application from JBuilder we get the following message:

  Warning: JIT compiler "javacomp" not found. Will use interpreter.
This means JBuilder cannot find the JIT compiler supplied by JBuilder for running the application. We can easily correct this by copying the JavaComp.dll from the redist folder in our JBuilder folder to the jre/bin folder of our JDK1.2.2 installation. Once we have copied this DLL file and run the application again we notice JBuilder uses the AppAccelerator.

Changing to JDK1.2.2 for running JBuilder 3
OK, we are now able to compile and run applications written with JDK1.2.2 classes and packages. But it would be nice if we could configure JBuilder to use JDK1.2.2 for the Visual Designer, so we can see in JBuilder self how our HTML text will look; and we don't have to guess how it will look.

The good news is that we can do this, and the bad news is that Borland doesn't support this. So we have to proceed at our own risk when we change the JDK JBuilder 3 is using itself for running JBuilder. One of the complications we encounter is that we can no longer access the Help from within the IDE. But next week's tip will show how we can work around this by starting the Help outside the IDE.

What needs to be done? First we must close JBuilder 3, because we will alter a INI file and this will not work correctly if JBuilder 3 is still running.

We can open our project again and open the frame source file in the Visual Designer. The following figure shows that we can see the result of the HTML text in the Visual Designer:

New JDK1.2.2 features in the Visual Designer of JBuilder 3

Well, it works! But please keep in mind that changing the JBuilder.ini file with the new value for the JavaVM property is not supported by Borland, and we have to face the consequences on our own risk. For example the fact we can no longer start the Help from within the IDE is one of the problems (again, we will see how to solve this one in the next tip).

This webpage © 1997-2009 by Bob Swart (aka Dr.Bob - All Rights Reserved.