- Using Visual J++ -

Chapter 2

Getting Started with Visual J++


In this chapter, you'll dive right into Visual J++ by installing the software if you have not yet done so. Then you will learn your way around the parts of the Visual J++ environment. This chapter shows you ways to use Visual J++ that match the needs of most users. Instead of an encyclopedia of commands and menu selections, you'll learn all the basics you need to get started developing Java applets and applications as soon as possible.

Visual J++'s interface matches that of Microsoft's current trend of providing the same development platform for whatever Microsoft language you decide to use. Therefore, once you master the Visual J++ Developer Studio, the program-creating tools that come with Visual J++, you'll also know your way around Visual C++ and Microsoft's FORTRAN Powerstation. Eventually, Microsoft promises to provide the Developer Studio platform for every language offered, including Visual Basic.

Turn on your computers and locate your Visual J++ CD-ROM. You're about to enjoy Visual J++!

Visual J++ Installation Issues

Installing Visual J++ is a fairly routine process if you have installed Windows software. Before installing the software, make sure that you have the following minimum hardware configuration:

 
The 16 megabyte RAM limit is hefty. In reality, you can get by with 8 megabytes but you will not appreciate the slow speed of the Visual J++ compiler in such a small memory space. In addition to the large RAM requirements, the hard disk requirement is also large. The Visual J++ system does not require that much space, but the on-line documentation consumes quite a bit of storage, and various install options may require a lot of megabytes. If you do not have 50 megabytes free, you can select certain installation options to decrease that requirement; with this decrease, Visual J++'s performance will slow down considerably.

The Visual J++ installation is fairly straightforward. You'll tell the Setup program which disk and directory to use for the install and then Visual J++ takes over. There are few decisions you need to make along the way, however, that might change the behavior of the installation. The following sections describe those installation decisions. Once Visual J++ finishes installing, you can elect to install Internet Explorer 3.0 as well.

Running Setup

To install Visual J++, insert the Visual J++ CD-ROM into your CD-ROM drive. If you've enabled AutoPlay, the CD-ROM's AutoPlay feature should take over and you'll see the Visual J++ welcome screen shown in figure 2.1.


FIG. 2.1

The Visual J++ opening screen.

 
If you do not see the Visual J++ opening screen after a few moments, choose Run from the Start menu, type d:\setup (replace d: with your CD-ROM drive letter), and press Enter.
 
 
Before installing Visual J++, you might want to take a few moments to play the animated introduction to Visual J++ that appears when you click Introducing Visual J++.

To start the installation, move your mouse pointer over Install Visual J++ 1.0. As soon as the mouse pointer rests over the title, the mouse pointing cursor changes to a hand and Install Visual J++ 1.0 highlights. Click your mouse button to begin the installation.

When the Visual J++ installation begins, your computer presents you with the Welcome dialog box shown in figure 2.2. The Welcome dialog box explains how long you can expect the installation to take and informs you that you can run the Setup program any time you like if you want to change the installation options.


FIG. 2.2

The Visual J++ Welcome dialog box.

Once you've read the Welcome dialog box, click the button labeled Next to read the Software License Agreement dialog box. The Setup program is actually a Windows 95 wizard and, as with most wizards, you'll click the Next button after selecting options in each installation dialog box to move to the next dialog box. If you click the Cancel button anywhere along the way, you'll cancel the installation and you'll have to start over from the beginning the next time you run Setup.

 
Use the PageDown key or click the scroll bar at the right of the license agreement to read through the whole agreement. Be sure to remember how to view this agreement... The next time you have insomnia, a couple of readings through the Visual J++ license agreement should take care of your sleeping problem in a hurry!

Unlike most wizard dialog boxes, you'll have to click the Yes button to move to the next Setup dialog box. The Yes button indicates that you've read and understood the license agreement (and that you have an advanced degree in tort law so that you can understand such an agreement!). If you do not want to agree to the licensing language, you can click No to cancel the installation. Microsoft generally assures you'll get a refund if you decide not to agree to their license; you simply have to return the software.

Once you click the Yes button to move on, you'll see the Registration dialog box shown in figure 2.3. Depending on your Windows settings, you may have to enter your name and organization in the dialog box as well as the CD key that appears on the back of your CD-ROM's jewel case. The 10-digit CD key will appear on your Visual J++ About dialog box after installation of Visual J++.

 
Often, Setup can grab your name and organization from your Windows Setup information. In addition, if the location for your CD key is grayed out, you do not have to enter the value. The CD key requirement is a minor attempt to cut down on unauthorized users.
 
 
If you ever call Microsoft for technical support, you'll quickly be able to locate for the Technical Support staff your registered product ID number by displaying the About dialog box. Therefore, you don't have to keep track of your Visual J++ serial number because Visual J++ keeps track of it for you once you enter the number in the Registration dialog box. Be sure to send in your registration card that came with Visual J++ so Microsoft can properly list your name and ID in their customer database. The installation routine also gives you a chance to register your copy of Visual J++ via your modem if you'd rather register electronically than fill out the card that comes with Visual J++.


FIG. 2.3

The Visual J++ Registration dialog box.

Perhaps one of the most important Setup program dialog boxes follows the Registration dialog box. The Installation Options dialog box, shown in figure 2.4, describes the four different ways you can install Visual J++. Using the Installation Options dialog box, you'll specify one of the following install options:


FIG. 2.4

The Installation Options dialog box.

If you are new to Java coding, as well as being new to the Developer Studio concept, select the Typical installation option. You should be pleased with the options the Typical option gives you. Of course, if you are running low on disk space, you'll have to select either the second or third option. Only select the Custom option if you know something about Visual J++, or if you've used another Microsoft product that supported the Developer Studio environment, or if you're bold and just want to have control over every detail of the installation.

Before clicking Next, notice the Directory button. As the Installation Options dialog box indicates in the lower right-hand corner, the default disk and pathname is C:\MSDEV\. If you want to install Visual J++ to a different disk drive, click the Directory button and change the C: to your preferred drive. I do not recommend that you change the path from MSDEV.

Once you decide on installation option, the disk, and path, click Next to display the final installation dialog box. After clicking Next, Visual J++ begins to install on your system. Depending on the speed of your computer, the installation may take 10 to 30 minutes. Once installed, click the Welcome screen's Exit button to return to your Windows environment.

 
If you've decided to use your modem to register your copy of Visual J++, you'll be able to select the modem registration option once the installation completes itself. The modem registration uses a toll-free number so you will not be billed for the call.

The Custom Installation

If you select the Custom installation option, you probably know quite a bit about development tools or you've used Microsoft's Developer Studio before now. If you fall into either of these categories, you probably need little help pursuing that installation option.

This text will not cover all the details of the Custom install because it is the nature of this book to describe the typical use of the Visual J++ development system. Nevertheless, you may want to take a moment to review some of your Custom install choices if you decide to control the installation yourself. There is one particular time when you may want to select the Custom option even if you're not extremely familiar with Visual J++ or with similar tools: if you want to install the entire Visual J++ system. In other words, none of the other three installation options installs the entire Visual J++ system onto your hard disk.

If you select the Custom installation option from the Installation Options dialog box, the Setup program presents you with the six choices shown in figure 2.5. the three selected choices are the Typical installation choices that the Setup program would have installed had you not overridden the default installation.


FIG. 2.5

You can decide exactly what you want to install.

Table 2.1 presents an overview of the six options. If any particular option contains additional sub-options, such as Database Options, you can click the Details button to select which, if any, of the option you want to install. Table 2.1 describes the options that you'll see when you install using the Custom option.

Table 2.1 You Can Customize the Visual J++ Options You Want to Use

Option Description
Microsoft Developer Studio Requests the editor, compiler, and related tools you need to write and compile Java-based programs. You must install the Developer Studio if you want to work with Visual J++.
Java Class Libraries Contains both the compiled and source class files. Class files are files with components you can use inside your own applets and applications. The source often helps you find errors during debugging sessions.
ActiveX Controls Installs the ActiveX-related technology that lets you turn your Java programs into OLE-like controls.
Tools Loads the resource editor and other utility programs you can use to help develop advanced Java programs.
Books Online Places the complete online documentation onto your hard disk for quick access when you need to find online help about Visual J++.

Do You Need Internet Explorer 3.0?

Unless you already have a Java-enabled Web browser that displays Visual J++-produced programs, you'll want to install Internet Explorer 3.0. Once you finish installing Visual J++, the installation procedure presents you with the Internet Explorer 3.0 Setup dialog box shown in figure 2.6. (If you have an outdated version of Internet Explorer 3.0, such as a beta test release, the Visual J++ Setup program will recognize that you do not have the latest Internet Explorer and will prompt you for the newest version's installation with figure 2.6's dialog box.)

 
If you have already installed Internet Explorer 3.0, Visual J++ will not prompt you for its installation.
 
 
If you've decided to use your modem to register your copy of Visual J++, you'll be able to select the modem registration option once the Internet Explorer 3.0 dialog box disappears. The modem registration uses a toll-free number so you will not be billed for the call. If you do not register from the dialog box, you can still register by mailing in your registration card or by selecting Register Visual J++ from the Start menu's Visual J++ submenu.

When you see figure 2.6's dialog box, select Install Internet Explorer 3.0 from the Welcome screen, which will reappear to install Internet Explorer 3.0. Once you accept the Internet Explorer 3.0 license agreement (as you did earlier when you installed Visual J++) , the installation process is automatic and requires no further interaction from you.


FIG. 2.6

Internet Explorer 3.0 runs Java-enabled applets.

 
Depending on the state of your current Internet Explorer version, if you have one already installed, you may see a Version Conflict dialog box during the installation of Internet Explorer 3.0. This means that the installation routine found a file on your disk with the same name as one that Internet Explorer 3.0 requires, except that the file on your disk is newer than the installation CD-ROM's matching file. Unless you have good reason not to, you should always click Yes to keep your existing (newer) file. Often, an update to Windows or to another program on your disk installs an updated library or system file that you need to keep for the other software to work well alongside Internet Explorer 3.0.

Internet Explorer 3.0 updates system information. After the Internet Explorer 3.0 process completes, Visual J++ displays a dialog box that requests that you restart Windows by clicking the Yes button. (If you have open applications with unsaved data, you'll be prompted to save the data before Windows restarts.) Be sure to restart Windows, either by clicking Yes or by restarting from the Start menu, before you use the newly-installed Internet Explorer 3.0 for the first time. When you install Visual J++, you can also install Internet Explorer 3.0 if you don't have Internet Explorer 3.0 on your system.

WinDiff Appears After Installing Visual J++

Once you install Visual J++, several options appear on the Visual J++ Start program's submenu. (These options also appear as icons if you open the Visual J++ window from Explorer, My Computer, or the File Manager.) Once of the options is called WinDiff.
 
WinDiff graphically (using indention of file and directory names) compares directories and lists of files to one another. When you develop software, you'll often get in the situation where you cannot easily tell how one source program (such as Java applet code) differs from another. WinDiff, which you invoke from an MS-DOS command line or from Windows, describes how files compare and differ from each other. For example, if you use WinDiff to compare two directories of Java applet code, WinDiff will inform you which files reside individually in each of the directories, and which files reside in both directories.
 
When creating different projects, the WinDiff information can be useful for learning when one directory is outdated or when one directory contains a file that is not in another directory.

You Can Uninstall Visual J++

If you ever want to uninstall Visual J++, you can do so easily by following these steps:

  1. Open your Control Panel by selecting Settings from the Start menu and then choosing Control Panel, or by double-clicking the My Computer icon and then double-clicking Control Panel.
  2. Double-click the Add/Remove Programs icon.
  3. Select Visual J++ from the list of programs you want to remove.
  4. Click the Add/Remove button to get rid of Visual J++. The removal process frees up all of your computer's disk space consumed by Visual J++.

You can also remove Internet Explorer 3.0 from the hard drive with the Control Panel's Add/Remove utility as well. Be sure to remember that Internet Explorer 3.0 is required if you want to surf Java-enabled Web pages unless you have another Java-enabled Web browser installed.

Starting and Exiting Visual J++

After installing Visual J++, when you return to your usual Windows startup screen, you may not realize right away how to start Visual J++. When you select the Microsoft Visual J++ Start menu program group, you will not see Visual J++ listed among the options. Remember that you create Visual J++ programs using the Developer Studio environment. Therefore, when you want to work with Visual J++, you first need to select Microsoft Developer Studio from the Microsoft Visual J++ program group. Once Windows loads and starts the Developer Studio, you'll see the Developer Studio environment.

If you've used other Windows 95 products very much, such as Microsoft Word 95, you'll already be familiar with the Tip of the Day dialog box that always appears when you start Visual J++. You can read through multiple tips by clicking the Next Tip button or you can close the dialog box and simply begin to work with Visual J++ by clicking Close.

 
Here's a tip you won't find on the Tip of the Day dialog box: If you load the file named MSDEV.TIP into an editor (such as the Visual J++ editor), you'll be able to edit and add your own tips of the day. You'll find the MSDEV.TIP file in the \MSDEV\BIN\IDE directory.

If you want to eliminate the Tip of the Day dialog box each time you start Visual J++, click the Show tips at startup option before closing the dialog box.

Once you finish your Visual J++ session, you should exit Visual J++ properly: you run the risk of losing data if you turn off your computer too soon. To quit Visual J++, click the close window button in the upper-right hand corner of the Visual J++ Developer Studio workspace window, double-click the control icon in the workspace's upper-left hand corner, or select the File, Exit from the menu bar. If you attempt to leave Visual J++ without saving your most recent edits, Visual J++ will ask if you want to save your work before exiting.

Knowing Your Way Around

Figure 2.7 describes the various parts of the Visual J++ Developer Studio screen that you'll find after closing the Tip of the Day dialog box. Table 2.2 describes these screen components.

 
Your Visual J++ screen details may differ slightly from figure 2.7's depending on your Visual J++ setup or a task you or someone else performed when your Visual J++ was last started.


FIG. 2.7

Important Visual J++ screen elements.

Other screen elements will appear as you work within Visual J++, but figure 2.7's elements are the most common screen components that you'll see when you start working in Visual J++.

Table 2.2 Visual J++'s Important Screen Elements

Element Description
Control icon The control icon produces the standard Windows control menu with which you can move, size, and close the Visual J++ Developer Studio workspace window.
Menu bar The menu bar is a standard Windows menu bar that produces pull-down menu options when you click on an option or press Alt along with the underlined letter. For example, if you click on the File menu bar option or press Alt+F, you'll see the File menu's options.
Standard toolbar This toolbar provides editing and file shortcuts. By clicking a toolbar button, you often can keep from selecting a menu option.
Find textbox The Find textbox displays a dropdown listbox of most your most recent search text. When you want to locate a certain word, command, or phrase in your Java code, you can enter a word to find in the Find textbox and press Enter to start the search.
Project toolbar This toolbar contains several debugging and compilation shortcuts.
Project Workspace window The Project Workspace window can contain these multiple tabbed items: ClassView, InfoViewer, FileView, and ResourceView. When you first start Visual J++, you'll typically see only InfoViewer. InfoViewer gives you access to online help and the Books Online references available with Visual J++. You'll see the ClassView tab when you create or modify a program that contains classes. (Most Java programs contain classes, as you'll learn as you get further into this book.) FileView lets you select which files you want to edit. FileView is useful because a Visual J++ application usually contains several files, not just a single program listing. These multiple files are stored in a larger collection called a project. Therefore, when you work with a project, you're working with a multi-file Visual J++ application or applet. You'll see the ResourceView tab when your project contains Windows resources such as menus and bitmaps.
Editing area The editing area contains a window that holds your program code as you write and edit Visual J++ programs. In addition, the Editing area displays resources, classes, and online help information.
Status bar Displays messages of Visual J++'s status, describes menu options as you highlight them, and displays some error messages and warnings.
 
All of the windows you see in the Visual J++ Developer Studio are movable and sizable. Therefore, you'll be able to arrange and resize them to suit your programming requirements. To resize a window, move your mouse pointer to the edge of a window and drag the window edge to another location to increase or decrease the window.

For now, familiarize yourself with the Visual J++ Developer Studio elements described in table 2.2. If you've used Visual C++, you already understand the Developer Studio and you are probably one step ahead of the game. Chapter 3, "Working Within Visual J++," will walk you through some exercises that let you use the Developer Studio and explain the Developer Studio further.

When You Need Help

All of the Books Online are available inside the InfoViewer. Therefore, if you see more than one tab in the Project Workspace window, click on InfoViewer to see the Books Online that are available to you.

When you want to access a Books Online topic, such as the Java API (the Java Application Programming Interface) reference, click on the plus sign to the left of the reference you want to read. Just as a book has chapters, the Books Online references contain sub-topics that are often further divided. As long as you see a plus sign to the left of a topic, you'll be able to expand the topic further for more detail. When the plus sign turns to a minus sign, you'll be able to click the minus sign to close the topic back to its closed form. Once you expand a topic down to a document icon, you'll be able to double-click the document icon and then you can read the text described. The topic's text appears inside the Editing area where you can scroll through the material and learn more about that topic.

 
When reading a page from Books Online, you might want to increase the size of the Editing area's window so you can read more text at one time without having to scroll the Editing area's window as much as you would otherwise have to do.

Figure 2.8 shows a Visual J++ session with a user reading about building a sample applet. Notice that the help text appears in the Editing area and the selected topic's title and document icons appear in the Project Workspace window.


FIG. 2.8

Read helpful information online with Visual J++.

Whenever scroll bars appear inside one of the Visual J++ Developer Studio windows, you can scroll the window up, down, left, and right to read all the window's contents. If no scroll bars appear, the window displays the entire topic. If you move your mouse pointer to an underlined hypertext link help topic, the mouse pointer changes to a pointing hand; when you click your mouse over that link, Visual J++ displays the help linked to the original topic.

Visual J++ supports several other kinds of online help in addition to the Books Online feature. The Help menu option lets you search for specific help topics throughout the entire set of help topics, define subsets of help documentation that you use a lot to speed searches, to read a Tip of the Day tip (in case you turned off the automatic Tip of the Day dialog box), to locate Microsoft-based technical support phone numbers and addresses, and to locate Web sites that carry Microsoft-related Visual J++ information.

 
Appendix B contains more information on Web sites that carry Visual J++ information and sample code.

In addition to the Books Online and Help menu bar options, Visual J++ supports context-sensitive help. When you begin writing programs, you can move your cursor over any command or keyword and press the F1 help key. Visual J++ instantly displays helpful information about that topic. When you use context-sensitive help, Visual J++ keeps both your code's Editing area window and a help topic window open.

Whenever you are finished reading a help topic, you can close the help topic by pressing Esc or by clicking the window close control button (the small button icon with an "X" on it) that appears in the upper-right hand corner's second row of window buttons. If you select a subsequent help topic before getting rid of the first one, Visual J++ overwrites the first topic's window with the new topic; multiple help topic windows do not stay active inside the Editing window.

Using the Help's toolbar

Notice in figure 2.8 the Help toolbar. The Help toolbar helps you navigate more easily through help topics.
 
The first Help toolbar button, the Sync Contents button, returns the Books Online window to the selected help topic if you display help text and the scroll the Books Online window to a different location. The next two Help toolbar buttons move you forward and backward, sequentially, through help topics. The Go back button (the fourth Help toolbar button) takes you to the help topic you looked at before the current topic (which may or may not be in sequential order to the previous topic).
 
If a help topic contains related text elsewhere in the online help system, the See Also button activates. When you click See Also, Visual J++ displays a list of related topics from which you can choose to find out related information about the topic you originally requested.
The Add Bookmark Help toolbar button displays the Add Bookmark dialog box shown in figure 2.9. You can assign your own reference name to any help topic and then return to that name later. By assigning your own named bookmarks, you'll create your own help reference system cross-referencing system.
 
Finally, the final Help toolbar button is an Add/Edit Annotate button that lets you add your own annotated notes to the help topics. When you click the Add/Edit Annotate button, a small editing window appears at the bottom of the current help topic in which you can add your own notes. The next time you display that help topic, your notes will appear there as well. If you find a special use for a command or keyword, you may want to add an annotation to that keyword's help topic for later reference.

As with most modern Windows programs, Visual J++ supports ToolTips, the pop-up descriptive text that appears when you rest your mouse pointer over a toolbar button.


FIG. 2.9

You can add your own bookmark reference titles to help topics.

Summary

The goal of this chapter was to walk you through the installation of a typical Visual J++ system. Visual J++ offers several options you can select that install a different set of Visual J++ tools and features. Depending on your disk space limitations, for example, you may want to install a more limited Visual J++ system such as the Minimum installation option that leaves the majority of Visual J++ on CD-ROM.

Once you install Visual J++, you can access all kinds of online help. Help is, therefore, never further away than your keyboard. By expanding and collapsing the Books Online references, you'll be able to zero-in on the help topics that will give you the most benefit.

This chapter covered the following points:


Previous Page TOC Next Page

| Previous Chapter | Next Chapter |

| Table of Contents | Book Home Page |

| Que Home Page | Digital Bookshelf | Disclaimer |


To order books from QUE, call us at 800-716-0044 or 317-361-5400.

For comments or technical support for our books and software, select Talk to Us.

© 1996, QUE Corporation, an imprint of Macmillan Publishing USA, a Simon and Schuster Company.