24 WebSphere Studio Application Developer Version 5 Programming Guide By using the -data parameter you can start a second instance of Application Developer that uses a different workspace. To start a new instance of Application Developer, start Application Developer with the -data workspacePath parameter. For example, if your second instance should use the NewWorkspace workspace folder, you can launch Application Developer with this command (this assumes Application Developer has been installed in the default installation directory): c:\Program Files\IBM\WebSphere Studio\wsappdev.exe -data c:\NewWorkspace There are a number of parameters that you can add when launching Application Developer (Table 2-1). Table 2-1 Startup parameters Command Description -data workspacedirectory Start Application Developer with a specific workspace. -configuration configurationFileURL The location for the platform configuration file, expressed as a URL. The configuration file determines the location of the platform, the set of available plug-ins, and the primary feature. Note that relative URLs are not allowed. The configuration file is written to this location when Application Developer is installed or updated. -vm vmPath This optional option allows you to set the location of Java Runtime Environment (JRE) to use to run Application Developer. Relative paths are interpreted relative to the directory that Eclipse was started from. -vmargs -Xmx256M For large-scale development you should modify your VM arguments to make more heap available. This example allows the Java heap to grow to 256MB. This may not be enough for large projects. -debug [optionsFileURL] Puts the platform in debug mode and loads the debug options from the file at the given URL, if specified. This file indicates which debug points are available for a plug-in and whether or not they are enabled. If a file path is not given, the platform looks in the directory that Application Developer was started from for a file called ".options". Note that relative URLs are not allowed. -consolelog Mirrors the Eclipse platform's error log to the console used to run Eclipse. Handy when combined with -debug. -setworkspace This flag forces Application Developer to display a prompt dialog for selecting of the workspace directory. Chapter 2. Setting up your Workbench and workspace preferences 25 Setting the workspace with a prompt dialog If you specify the flag -setworkspace, Application Developer displays a startup dialog for selecting the workspace directory (Figure 2-2). Figure 2-2 Select workspace Do not select the check box Use this workspace as the default , otherwise you are not prompted again. All other startup parameters are described in Application Developer’s help facility. Memory consideration Use the -vmargs flag to set limits to the memory that is used by Application Developer. For example, with only 512 MB RAM you may be able to get better performance by limiting the memory: -vmargs -Xmx150M You can also modify VMArgs initialization parameters in the wsappdev.ini file (in the installation directory): VMArgs=-Xms64M -Xmx150M -Xquickstart -Xgcpolicy:optavgpause These arguments significantly limit the memory utilization. Setting the -Xmx argument below 150M does begin to degrade performance. For more information on memory management for the built-in WebSphere server, see “Environment page” on page 547. Tip: If you want to work with multiple workspaces create a duplicate startup icon for Application Developer and use the -data flag to point to the workspace. 26 WebSphere Studio Application Developer Version 5 Programming Guide Application Developer’s log files Application Developer provides logging facilities for plug-in developers to log and trace important events, primarily expected or unexpected errors. Log files are a crucial part of the Application Developer problem determination process. The only reason to use log files is if you encounter unexpected program behavior. In some cases, an error message tells you explicitly to look at the error log. There are two main log files in the .metadata directory of the workspace folder: .log—The .log file is used by the Workbench to capture errors, and any uncaught exceptions from plug-ins. The .log file is cumulative, each new session of Application Developer appends its messages to the end of the .log file without deleting any previous messages. This enables you to see a history of past messages over multiple Application Developer sessions, each one starting with the !SESSION string. LoggingUtil.log—The LoggingUtil.log file is provided by the Application Developer specific tools (a set of plug-ins added on top of the Workbench). The Application Developer plug-ins use LoggingUtil.log to log various events, errors, and caught exceptions through a logging API. Both log files are ASCII files and can be viewed with any text editor. Preferences Application Developer’s preferences can be modified by selecting Window -> Preferences from the menu bar. Opening the preferences displays the dialog shown in Figure 2-3. In the left pane you can navigate through many entries. Each entry has its own preferences page, where you can change the initial options. This section describes the most important options. Application Developer’s help manual contains a complete description of all options available in the preferences dialogs. Tip: Each page of Application Developer’s preferences dialog contains a Restore Defaults button. When you click this button, Application Developer restores the settings of the current dialog to its initial values. Chapter 2. Setting up your Workbench and workspace preferences 27 Figure 2-3 Workbench preferences Automatic builds By default, builds in Application Developer are done automatically whenever a resource has been modified and saved. If you require more control regarding builds you can disable the auto-building feature. To perform a build you have to explicitly start it. This may be a desirable in cases where you know that building is of no value until you finish a large set of changes. If you want to turn off the automatic build feature, select Windows -> Preferences -> Workbench and deselect the Perform build automatically on resource modification check box (see previous Figure 2-3). 28 WebSphere Studio Application Developer Version 5 Programming Guide In this dialog you can also specify whether or not you want unsaved resources to be saved before performing a manual build. Check the Save all modified resources automatically prior to manual build check box to enable this feature. File associations The File Associations preferences page (Figure 2-4) enables you to add or remove file types recognized by the Workbench. You can also associate editors or external programs with file types in the file types list. Figure 2-4 File associations preferences The top right pane allows you to add and remove the file types. The bottom right pane allows you to add or remove the associated editors. If you want to add, for example, the Internet Explorer as an additional program to open your .gif files, select *.gif from the file types list and click Add next to the associated editors pane. Chapter 2. Setting up your Workbench and workspace preferences 29 A new dialog opens (Figure 2-5) where you have to select the External Programs option, then click Browse and select iexplore.exe from the folder where Internet Explorer is installed and confirm the dialog with O pen . Figure 2-5 File association editor selection Confirm the Editor Selection dialog with OK and you will notice that the program has been added to the editors list. Optionally you can set this program as the default program for this file type by clicking Default . Now you can open the file by using the context menu on the file and select Open With and select the appropriate program. Local history A local edit history of a file is maintained when you create or modify a file. A copy is saved each time you edit and save the file. This allows you to replace the current file with a previous edit or even restore a deleted file. You can also compare the content of all the local edits. Each edit in the local history is uniquely represented by the data and time the file has been saved. Note: Only files have local history. Projects and folders do not have a local history. 30 WebSphere Studio Application Developer Version 5 Programming Guide To compare a file with the local history, select Compare With -> Local History from its context menu. To replace a file with an edit from the local history, select Replace With -> Local History from its context menu. Select Window -> Preferences -> Workbench -> Local History to open its preferences page (Figure 2-6). Figure 2-6 Local history preferences Table 2-2 explains the options for the local history preferences. Table 2-2 Local history settings Option Description Days to keep files Indicates for how many days you want to maintain changes in the local history. History state older than this value will be lost. Entries per file This option indicates how many history states per file you want to maintain in the local history. If you exceed this value, you will lose older history to make room for new history. Maximum file size (MB) Indicates the maximum size of individual states in the history store. If a file is over this size, it will not be stored. Chapter 2. Setting up your Workbench and workspace preferences 31 Perspectives preferences The Perspectives preferences page enables you to manage the various perspectives defined in the Workbench. To open the page, click Window -> Preferences -> Workbench -> Perspectives (Figure 2-7). Figure 2-7 Perspectives preferences Here you can change the following options: Open a new perspective in the same or in a new window Open a new view within the perspective or as a fast view (docked to the side of the current perspective) Open a new project in the same window, in a new window or do not switch the perspective 32 WebSphere Studio Application Developer Version 5 Programming Guide There is also a list with all available perspectives where you can select the default perspective. If you have added one or more customized perspectives you can delete them here if you want to. Internet preferences When using Application Developer and working within an intranet, you may want to use a proxy server to get across the firewall to access the Internet. To be able to access the Internet from Application Developer, you have to set preferences for the HTTP proxy server within the Workbench. You can do this by clicking Window -> Preferences and selecting Internet (Figure 2-8). Figure 2-8 Internet preferences Chapter 2. Setting up your Workbench and workspace preferences 33 Java development preferences Application Developer provides a number of coding preferences. Some of these are described in this section. Chapter 5, “Developing Java applications” on page 93 also provides information regarding these preferences and Java coding. Java classpath variables Application Developer provides a number of default classpath variables. classpath variables can be used in a Java build path to avoid a reference to the local file system. Using a variable entry, the classpath only contains a variable. This is a good idea when developing within a team as the team members do not have to change their directory structure. Depending on the type of Java coding you plan to do, you may have to add variables pointing to other code libraries. For example, this can be driver classes to access relational databases or locally developed code that you would like to reuse in other projects. Once you have created a Java project, you can add any of these variables to the project’s classpath. Chapter 5, “Developing Java applications” on page 93 provides more information on adding classpath variables to a Java project. To view and change the default classpath variables, click Window -> Preferences and select Java -> Classpath Variables from the list. A list of the existing classpath variables is displayed as shown in Figure 2-9. You can create, edit and remove variables by using this dialog. Click New to add a new variable. A new dialog comes up where you have to enter the name of the variable and specify its path and file. . Application Developer and use the -data flag to point to the workspace. 26 WebSphere Studio Application Developer Version 5 Programming Guide Application Developer s log files Application Developer. 24 WebSphere Studio Application Developer Version 5 Programming Guide By using the -data parameter you can start a second instance of Application Developer that uses a different. resource modification check box (see previous Figure 2-3). 28 WebSphere Studio Application Developer Version 5 Programming Guide In this dialog you can also specify whether or not you want