Java Development User Guide
Java Development User Guide
Contents
Java development overview Getting Started Concepts Tasks Reference Tips and tricks What's new Legal
Getting Started
Contents
Basic tutorial
This tutorial provides a step by step walk-through of the Java development tools. Next Section: Preparing the workbench -----------------------------------------------------------------------------
Java development user guide > Getting Started > Basic tutorial
Preparing Eclipse
In this section, you will verify that Eclipse is properly set up for Java development. The following is assumed:
You are starting with a new Eclipse installation with default settings. You are familiar with the basic Eclipse workbench mechanisms, such as views and perspectives.
If you're not familiar with the basic workbench mechanisms, please see the Getting Started chapter of the Workbench User Guide.
4.
Select the
General > Workspace preference page. Confirm that the Build automatically option is checked.
5.
Select the
Java > Build Path preference page. Confirm that Source and output folder is set to Folders.
6.
Select the
Java > Editor preference page. Confirm that option Report problems as you type is checked.
7.
Select the Java > Compiler preference page. Confirm that option Compiler compliance level matches your default JRE version (usually 1.6).
8.
Installed JREs Preferences Java Editor Preferences ----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
On this page,
o o
type "JUnit" in the Project name field, and select "J2SE-1.4" in the Use an execution environment JRE field.
Then click Finish. 3. 4. 5. 6. In the Package Explorer, expand the JUnit project and select the source folder src. Select the menu item File > Import.... Expand General, select Archive file, and click Next. Click the Browse button next to the Archive file field and browse to select
<Downloads>/junit381src.jar
Note: This step assumes that you followed steps 1 and 2 in the Getting the Sample Code section above. 7. In the Import wizard, expand the root node, press Deselect All and select only the junit node. You can expand and select elements within the junit directory on the left pane to view the individual resources that you are importing on the right pane. Note: Do not deselect any of the resources in the junit directory at this time. You will need all of these resources in the tutorial.
8. 9.
Make sure that the JUnit project's source folder appears in the destination Into folder field. Then click Finish. In the import progress indicator, notice that the imported resources are compiled as they are imported into the workbench. This is because the Build automatically option is checked on the Workbench preferences page. In the Package Explorer view, expand the JUnit project and the src folder to view the JUnit packages.
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
Java views
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
Opening a Java editor Using quick views Adding new methods Using content assist Identifying problems in your code Using code templates Organizing import statements Using the local history Extracting a new method
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial > Editing Java elements
3.
Look at the Outline view. It displays an outline of the Java file including the package declaration, import declarations, fields, types and methods. The Outline view uses icons to annotate Java elements. For example, icons indicate whether a Java element is static ( ), abstract ( ), or final ( ). Different icons show you whether a method overrides a method from a base class ( ) or when it implements a method from an interface ( ).
4.
Toggle the Hide Fields, Hide Static Members, and Hide Non-Public Members buttons in the Outline view toolbar to filter the view's display. Before going to the next step make sure that the Hide Non-Public Members and Hide Static Fields and Methods buttons are not pressed.
5. In the Outline view, select different elements and note that they are again displayed in a whole file view in the editor. The Outline view selection now contains a range indicator on the vertical ruler on the left border of the Java editor that indicates the range of the selected element.
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial > Editing Java elements
In this section, you will be introduced to the quick outline view. Quick views are in-place views which are shown on top of the editor area and can easily be controlled using the keyboard. A second quick view will be introduced in the Type Hierarchy section.
Quick Outline
To use the quick outline view in the Java editor:
1. 2. Open junit.samples.VectorTest.java file in the Java editor if you do not already have it open. Press Ctrl+O or select Navigate > Quick Outline and you will see an in-place outline of the current source file.
3. 4.
Press Ctrl+O a second time and all inherited fields, types and methods are shown as well. Inherited members are shown in grey. Start typing while the quick outline view is shown to filter the list of displayed elements. Further, use the arrow keys to navigate in the outline view and press Enter to reveal the selected element in the Java editor.
5.
Click the triangle in the upper right corner to see the quick view menu:
The menu items can be divided into 3 categories: o Position - Allows you to resize and move the quick view and to remember these settings o Filter - Define filters so that not all members are shown in the quick outline. o Sort - Sort the members by their defining type or alphabetically.
Note: Ctrl+O always opens the outline for the current Java editor. Press Ctrl+F3 to open the quick outline for the currently selected type. Next Section: Adding new methods
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial > Editing Java elements
Start adding a method by typing the following at the end of the VectorTest.java file (but before the closing brace of the type) in the Java editor:
public void testSizeIsThree()
As soon as you type the method name in the editor area, the new method appears at the bottom of the Outline view.
In addition,
o o o o
error annotations (red boxes) appear in the overview ruler positioned on the right hand side of the editor, error icons appear in the vertical ruler positioned on the left of the editor, an error indicator appears in the top right corner of the editor, errors are marked in the text.
These error annotations indicate that the compilation unit is currently not correct. If you hover over the error in the text, a tool tip appears: Syntax error on token ")", { expected after this token. This is correct since the method doesn't have a body yet. Note that error annotations in the editor are updated as you type. This behavior can be controlled via the Report problems as you type option located on the Java > Editor preference page.
2.
Click the Save button. The compilation unit is compiled automatically and errors appear in the Package Explorer view, in the Problems view and on the vertical ruler (left hand side of the editor). In the Package Explorer view, the errors are propagated up to the project of the compilation unit containing the error.
Note that the closing curly brace has been inserted automatically. 4. Save the file. Notice that the error indicators disappear since the missing brace has been added. Next Section: Using content assist
Java editor
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial > Editing Java elements
2.
With your cursor at the end of the word assert, press Ctrl+Space to activate content assist. The content assist window with a list of proposals will appear. Scroll the list to see the available choices.
3.
With the content assist window still active, type the letter 't' in the source code after assert (with no space in between). The list is narrowed and only shows entries starting with 'assert'. Single-click various items in the list to view any available Javadoc help for each item.
Select assertTrue(boolean) from the list and press Enter. The code for the assertTrue(boolean) method is inserted. 5. Complete the line so that it reads as follows:
4.
assertTrue(v.size() == fFull.size());
Java editor
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial > Editing Java elements
3.
Click the Save button. The project is rebuilt and the problem is indicated in several ways: o In the Problems view, the problems are listed, o In the Package Explorer view, the Type Hierarchy or the Outline view, problem ticks appear on the affected Java elements and their parent elements, o In the editor's vertical ruler, a problem marker is displayed near the affected line, o Squiggly lines appear under the word which might have caused the error, and o The editor tab is annotated with a problem marker.
4. You can hover over the marked word in the editor to view a description of the problem. You can also hover over the problem markers in the vertical or overview rulers.
5. 6.
Click the Close ("X") button on the editor's tab to close the editor. In the Problems view, select a problem in the list. Open its context menu and select Go To. The file is opened in the editor at the location of the problem.
Correct the problem in the editor by adding the semicolon. Click the Save button. The project is rebuilt and the problem indicators disappear. 8. In the Outline view, select the method getName(). The editor will scroll to this method. 9. On the first line of the method change the returned variable fName to fTestName. While you type, a problem highlight underline appears on fTestName, to indicate a problem. Hovering over the highlighted problem will display a description of the problem and applicable quick fixes. 10. On the marker bar a light bulb marker appears. The light bulb signals that correction proposals are available for this problem.
7.
11.
Click to place the cursor onto the highlighted error, and choose Quick Fix from the Edit menu bar. You can also press Ctrl+1 or left click the light bulb. A selection dialog appears with possible corrections.
12. Select 'Change to fName' to fix the problem. The problem highlight line will disappear as the correction is applied. 13. Close the file without saving. 14. You can configure how problems are indicated on the General > Editors > Text Editors > Annotations preference page.
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial > Editing Java elements
With the cursor at the end of for, press Ctrl+Space to enable content assist. You will see a list of common templates for "for" loops. When you single-click a template, or select it with the Up or Down arrow keys, you'll see the code for the template in its help message. Note that the local array name is guessed automatically.
3.
Choose the for - iterate over array entry and press Enter to confirm the template. The template will be inserted in your source code.
4.
Next we change the name of the index variable from i to e. To do so simply press e, as the index variable is automatically selected. Observe that the name of the index variable changes at all places. When inserting a template all references to the same variable are connected to each other. So changing one changes all the other values as well.
5.
Pressing the tab key moves the cursor to the next variable of the code template. This is the array expected.
Since we don't want to change the name (it was guessed right by the template) we press tab again, which leaves the template since there aren't any variables left to edit.
6.
7.
With the cursor at the end of to, press Ctrl+Space to enable content assist. Pick toarray convert collection to array and press Enter to confirm the selection (or double-click the selection).
The template is inserted in the editor and type is highlighted and selected.
8. 9.
Overwrite the selection by typing Integer. The type of array constructor changes when you change the selection. Press Tab to move the selection to collection and overwrite it by typing fFull.
10. Add a semicolon and the following lines of code to complete the method:
assertEquals(expected.length, actual.length); for (int i= 0; i < actual.length; i++) assertEquals(expected[i], actual[i]);
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial > Editing Java elements
Delete the import declarations by selecting them in the Outline view and selecting Delete from the context menu. Confirm the resulting dialog with Yes. You will see numerous compiler warnings in the vertical ruler since the types used in the method are no longer imported.
2.
From the context menu in the editor, select Source > Organize Imports. The required import statements are added to the beginning of your code below the package declaration.
You can also choose Organize Imports from the context menu of the import declarations in the Outline view. Note: You can specify the order of the import declarations using the Java > Code Style > Organize Imports preference page. 3. Save the file. Next Section: Using the local history
Java editor
-----------------------------------------------------------------------------
Java development user guide > Getting Started > Basic tutorial > Editing Java elements
In the Outline view, select the method testCapacity(), and from its context menu, select Replace With > Element from Local History. In the Replace Java Element from Local History dialog, the Local History list shows the various saved states of the method. The Java Source Compare pane shows details of the differences between the selected history resource and the existing workbench resource.
In the top pane, select the previous version, and click the Replace button. In the Java editor, the method is replaced with the selected history version. 6. Save the file. 7. Beside replacing a method's version with a previous one you can also restore Java elements that were deleted. Again, select the method testCapacity() in the Outline view, and from its context menu, select Delete. Confirm the resulting dialog with Yes and save the file. 8. Now select the type VectorTest in the Outline view, and from its context menu, select Restore from Local History.... Select and check the method testCapacity() in the Available Java Elements pane. As before, the Local History pane shows the versions saved in the local history.
5.
9.
In the Local History pane, select the earlier working version and then click Restore.
Java editor
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial > Editing Java elements
In the junit.framework/TestSuite.java file, select the following range of code inside the TestSuite(Class) constructor:
Class superClass= theClass; Vector names= new Vector(); while(Test.class.isAssignableFrom(superClass)) { Method[] methods= superClass.getDeclaredMethods(); for (int i= 0; i < methods.length; i++) { addTestMethod(methods[i],names, constructor); } superClass= superClass.getSuperclass(); }
2.
From the selection's context menu in the editor, select Refactor > Extract Method....
3.
4.
To preview the changes, press Preview>.The preview page displays the changes that will be made. Press OK to extract the method.
Java Preferences
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
In the Package Explorer view, select the JUnit project. Click the New Java Package button in the toolbar, or select New > Package from the project's context menu . In the Name field, type test as the name for the new package. Then click Finish. In the Package Explorer view, select the new test package and click the New Java Class button in the toolbar. Make sure that JUnit appears in the Source Folder field and that test appears in the Package field. In the Name field, type MyTestCase.
5. 6.
Click the Browse button next to the Superclass field. In the Choose a type field in the Superclass Selection dialog, type Test to narrow the list of available superclasses.
7. 8. 9.
Select the TestCase class and click OK. Select the checkbox for Constructors from superclass. Click Finish to create the new class.
10.
11.
The new file is opened in the editor. It contains the new class, the constructor and comments. You can select options for the creation and configuration of generated comments in the Java > Code Style > Code Templates preference page. In the Outline view select the new class MyTestCase. Open the context menu and select Source > Override/Implement Methods....
12.
In the Override Methods dialog, check setUp() and tearDown() and click OK. Two methods are added to the class.
13. 14.
Change the body of setUp() to container= new Vector(); container and Vector are underlined with a problem highlight line as they cannot be resolved. A light bulb appears on the marker bar. Move the mouse over the underlined word Vector. A hover appears that shows the error message and contains quick fixes. Move the mouse into the hover and click Import 'Vector' (java.util). This adds the missing import declaration.
The blinking cursor should still be on the line that contains the error (if not, set it to the end of the line). Press Ctrl+1. This lets the cursor jump to the nearest error location and opens the quick fix proposals. Choose Create field 'container' to add the new field.
15.
In the Outline view, select the class MyTestCase. Open the context menu and select Source > Generate Getters and Setters....
16.
The Generate Getter and Setter dialog suggests that you create the methods getContainer and setContainer. Select both and click OK. A getter and setter method for the field container are added.
17. Save the file. 18. The formatting of generated code can be configured in the Java > Code Style > Formatter preference page. If you use a prefix or suffix for field names (e.g. fContainer), you can specify this in the Java > Code Style preference page so that generated getters and setters will suggest method names without the prefix or suffix. Next Section: Renaming Java elements
New Java Class wizard Source actions Quick fix Override methods dialog Generate Getter and Setter dialog
Code formatter preference page Code style preference page Code templates preference page
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
In the Package Explorer view, select junit.framework/TestCase.java. From its context menu, select Refactor > Rename. In the New Name field on the Rename Compilation Unit page, type "TestCase2".
To preview the changes that will be made as a result of renaming the class, press Next. 5. The workbench analyzes the proposed change and presents you with a preview of the changes that would take place if you rename this resource.
4.
Since renaming a compilation unit will affect the import statements in other compilation units, there are other compilation units affected by the change. These are shown in a list of changes in the preview pane.
6. On the Refactoring preview page, you can scroll through the proposed changes and select or deselect changes, if necessary. You will typically accept all of the proposed changes. 7. Click Finish to accept all proposed changes. You have seen that a refactoring action can cause many changes in different compilation units. These changes can be undone as a group.
1.
In the menu bar, select Edit > Undo Rename Compilation Unit.
2. The refactoring changes are undone, and the workbench returns to its previous state. You can undo refactoring actions right up until you change and save a compilation unit, at which time the refactoring undo buffer is cleared. Next Section: Moving and copying Java elements
Refactoring support
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
2.
3.
In the Package Explorer view, select the MyTestCase.java file from the test package and drag it into the junit.samples package. Dragging and dropping the file is similar to selecting the file and choosing Refactor > Move from the context menu. You will be prompted to select whether or not to update references to the file you are moving. Typically, you will want to do this to avoid compile errors. You can press the Preview button to see the list of changes that will be made as a result of the move. Press OK. The file is moved, and its package declaration changes to reflect the new location.
4.
The context menu is an alternative to using drag and drop. When using the menu, you must specify a target package in the Move dialog, in addition to selecting the update references options you've already seen.
1. 2.
Select the MyTestCase.java file and from its context menu, select Refactor > Move. In the Move dialog, expand the hierarchy to browse the possible new locations for the resource. Select the junit.samples package, then click OK. The class is moved, and its package declaration is updated to the new location.
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
Open the Open Type dialog by pressing Ctrl+Shift+T, choosing Navigate > Open Type..., or clicking the toolbar icon ( ). Type Money, press the Arrow Down key a few times to select MoneyTest, and then press Enter to open the type in the Java editor.
2.
On the first line of the MoneyTest class declaration, select the superclass TestCase and either o from the menu bar select Navigate > Open Declaration or o press F3.
The TestCase class opens in the editor area and is also represented in the Outline view. Note: This command also works on methods and fields.
3.
With the TestCase.java editor open and the class declaration selected: o from the menu bar select Navigate > Open Type Hierarchy or o press F4.
Note: You can also open editors on types and methods in the Hierarchy view. Next Section: Viewing the type hierarchy
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
In the Package Explorer view, find junit.framework/TestCase.java. From its context menu, select Open Type Hierarchy. You can also open type hierarchy view: o from the menu bar by selecting Navigate > Open Type Hierarchy. o from the keyboard by pressing F4 after selecting TestCase.java.
2.
The buttons in the view tool bar control which part of the hierarchy is shown. Click the Show the Type Hierarchy button to see the class hierarchy, including the base classes and subclasses. The small arrow on the left side of the type icon of TestCase indicates that the hierarchy was opened on this type.
3.
Click the Show the Supertype Hierarchy button to see a hierarchy showing the type's parent elements including implemented interfaces. This view shows the results of going up the type hierarchy.
In this "reversed hierarchy" view, you can see that TestCase implements the Test interface.
4.
Click the Show the Subtype Hierarchy button in the view toolbar.
5.
Click the Lock View and Show Members in Hierarchy button in the toolbar of the member pane, then select the runTest() method in the member pane. The view will now show all the types implementing runTest().
6.
In the Hierarchy view, click the Show the Supertype Hierarchy button. Then on the member pane, select countTestCases() to display the places where this method is declared.
7. 8.
In the Hierarchy view select the Test element and select Focus On 'Test' from its context menu. Test is presented in the Hierarchy view. Activate the Package Explorer view and select the package junit.framework. Use Open Type Hierarchy from its context menu. A hierarchy is opened containing all classes of the package. For completion of the tree, the hierarchy also shows some classes from other packages. These types are shown by a type icon with a white fill.
9.
Use Previous Type Hierarchies to go back to a previously opened element. Click on the arrow next to the button to see a list of elements or click on the button to edit the history list.
If you are working in the editor and only want to do a quick lookup for a hierarchy you can use the Quick Type Hierarchy: Open junit.framework.TestCase.java file in the Java editor if you do not already have it open. 2. Select the type name in the Java editor 3. Press Ctrl+T or invoke Navigate > Quick Type Hierarchy and the in-place type hierarchy view is shown. 4. Pressing Ctrl+T while the type hierarchy view is shown will toggle between supertype hierarchy and subtype hierarchy.
1.
4.
In the body of runBare() select the invocation of setUp() Press Ctrl+T or invoke Navigate > Quick Type Hierarchy and the in-place type hierarchy view is shown. You can see that setIup() is implemented in 3 more classes. Object and Assert are only shown with a white filled images as are only required to complete the hierarchy but do not implement setUp() Select a type to navigate to its implementation of setUp()
Java views
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
Then click Search. While searching you may click Cancel at any time to stop the search. Partial results will be shown. 4. In the Java perspective, the Search view shows the search results.
Use the Show Next Match ( ) and Show Previous Match ( match was found is not currently open, it is opened in an editor. 5.
When you navigate to a search match using the Search view buttons, the file opens in the editor at the position of the match. Search matches are tagged with a search marker in the rulers.
If you want to follow multiple levels of method calls, you can also use Navigate > Open Call Hierarchy.
4.
To find all files of a given file name pattern, leave the Containing Text field empty.
The Previous Search Results button will display a dialog with the list of all previous searches from the current session.
Selecting a previous search from this dialog will let you view that search. Next Section: Running your programs
Java search
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
In the Package Explorer view, find junit.textui/TestRunner.java and double-click it to open it in an editor. In the Outline view, notice that the TestRunner class has an icon which indicates that the class defines a main method.
3.
Right click on TestRunner.java in the Package Explorer and select Run As > Java Application. This will launch the selected class as a local Java application. The Run As context menu item is also available in other places, such as the Outline view.
4. Notice that the program has finished running and the following message appears in the Console view telling you that the program needs an execution argument. Running class from the Package Explorer as a Java Application uses the default settings for launching the selected class and does not allow you to specify any arguments.
5.
To specify arguments, use the drop-down Run menu in the toolbar and select Run Configurations....
You can also Ctrl+Click a configuration in the drop-down menu to start editing that configuration.
6.
This time, the Launch Configurations dialog opens with the TestRunner launch configuration selected. A launch configuration allows you to configure how a program is launched, including its arguments, classpath, and other options. (A default launch configuration was created for you when you chose Run > Java Application).
7.
Select the Arguments tab and type junit.samples.VectorTest in the Program arguments area.
8.
Click Run. This time the program runs correctly, indicating the number of tests that were run.
9. Switch to the Debug perspective. In the Debug view, notice that a process for the last program launch was registered when the program was run. By default, the Debug view automatically removes any terminated launches when a new launch is created. This preference can be configured on the Run/Debug > Launching preference page
Note: You can relaunch a terminated process by selecting Relaunch from its context menu.
10.
Select the drop-down menu from the Run button in the workbench toolbar. This list contains the previously launched programs. These programs can be relaunched by selecting them in the history list.
11.
By default the currently selected resource or active editor is launched when the run button is hit. If none of these is launchable the current project will be launched. You can configure this behaviour under Run/Debug > Launching.
12.
From the context menu in the Debug view (or the equivalent toolbar button), select Remove All Terminated to clear the view of terminated launch processes.
Changing debugger launch options Connecting to a remote VM with the Remote Java application launch configuration Disconnecting from a VM Launching a Java program Running and debugging
Debug view Run menu actions Run and debug toolbar actions
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
The breakpoint icon indicates the status of the breakpoint. The plain blue breakpoint icon indicates that the breakpoint has been set, but not yet installed. Note: Once the class is loaded by the Java VM, the breakpoint will be installed and a checkmark overlay will be displayed on the breakpoint icon.
3.
4.
In the Package Explorer view, select the junit.samples package and select Debug As, and then Java Application. When you run a program from a package, you will be prompted to choose a type from all classes in the package that define a main method. Select the VectorTest item in the dialog, then click OK.
Note: You can also simply hit the debug button which will launch the currently selected resource or active editor. Select Java Application when you are prompted to select a way to debug VectorTest.
5.
The program will run until the breakpoint is reached. When the breakpoint is hit, execution is suspended, and you are asked whether to open the Debug perspective. Click Yes. Notice that the process is still active (not terminated) in the Debug view. Other threads might still be running.
Note: The breakpoint now has a checkmark overlay in the Java VM.
6.
In the editor in the Debug perspective, select new Vector() from the line above where the breakpoint is set, and from its context menu, select Inspect.
7. The expression is evaluated in the context of the current stack frame, and a pop-up appears which displays the results. You can send a result to the Expressions view by pressing the key binding displayed in the pop-up. 8. Expressions that you evaluate while debugging a program will be listed in this view. To delete an expression after working with it, select the expression and choose Remove from its context menu. 9. The Variables view (available on a tab along with the Expressions view) displays the values of the variables in the selected stack frame. Expand the this.fFull tree in the Variables view until you can see elementCount. 10. The variables (e.g., elementCount) in the Variables view will change when you step through VectorTest in the Debug view. To step through the code, click the Step Over ( ) button. Execution will continue at the next line in the same method (or, if you are at the end of a method, it will continue in the method from which the current method was called).
11.
In the variables view you can choose to see certain types as logical structures. This hides the implementation details of a type and simply shows it as arrays or fields. You can define logical structures by yourself in the preference page Java > Debug > Logical Structures.
Try some other step buttons (Step Into , Step Return ) to step through the code. Note the differences in stepping techniques. 13. You can end a debugging session by allowing the program to run to completion or by terminating it. o You can continue to step over the code with the Step buttons until the program completes. o You can click the Resume ( ) button to allow the program to run until the next breakpoint is encountered or until the program is completed. o You can select Terminate from the context menu of the program's process in the Debug view to terminate the program.
12.
Adding breakpoints Resuming the execution of suspended threads Running and debugging Suspending threads
Debug preferences Debug view Run menu actions Run and debug toolbar actions Breakpoints view Console view Display view Expressions view Variables view
-----------------------------------------------------------------------------
Java development user guide > Getting Started > Basic tutorial
Evaluating expressions
In this section, you will evaluate expressions in the context of your running Java program.
1.
2.
Debug junit.samples.VectorTest.java to the breakpoint in the setUp() method and select Step Over twice to populate fFull. (See the Debugging your Programs section for full details.) Open the Display view by selecting Window > Show View > Display and type the following line in the view:
fFull.size()
3.
Select the text you just typed, and from its context menu, select Display. (You can also choose Display Result of Evaluating Selected Text ( ) from the Display view toolbar.)
4. The expression is evaluated and the result is displayed in the Display view.
Select this line, and select Inspect from the context menu. (You can also choose Inspect Result of Evaluating Selected Text ( ) from the Display view toolbar.) 7. A lightweight window opens with the value of the evaluated expression.
6.
Debugger
Evaluating expressions Displaying the result of evaluating an expression Inspecting the result of evaluating an expression
Expressions view
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
Evaluating snippets
In this section, you will evaluate Java expressions using the Java scrapbook. Java scrapbook pages allow you to experiment with Java code fragments before putting them in your program.
1.
In the File menu select New > Other > Java > Java Run/Debug > Scrapbook Page. You will be prompted for a folder destination for the page.
2. 3. 4.
5.
In the Enter or select the folder field, type or browse below to select the JUnit project root directory. In the File name field, type MyScrap. Click Finish when you are done. A scrapbook page resource is created for you with the jpage file extension. (The jpage file extension will be added automatically if you do not enter it yourself.) The scrapbook page opens automatically in an editor. In the editor, type System.get and then use content assist (Ctrl+Space) to complete the snippet as System.getProperties().
6.
Select the entire line you just typed and select Display from the context menu. You can also select Display Result of Evaluating Selected Text from the toolbar.
7. When the evaluation completes, the result of the evaluation is displayed and highlighted in the scrapbook page. 8. You can inspect the result of an evaluation by selecting text and choosing Inspect from the context menu (or selecting Inspect Result of Evaluating Selected Text from the toolbar.) 9. When you are finished evaluating code snippets in the scrapbook page, you can close the editor. Save the changes in the page if you want to keep the snippets for future use. Next Section: Using the Java browsing perspective
Debugger
Creating a Java scrapbook page Displaying the result of evaluating an expression Inspecting the result of evaluating an expression
New Java Scrapbook Page wizard Java scrapbook page Expressions view
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
uses distinct views to present the same information. Selecting an element in one view, will show its content in another view. To open a browsing perspective activate Window > Open Perspective > Java Browsing from within the Java perspective or use the context menu of the Open a Perspective toolbar button.
The views of the perspective are connected to each other in the following ways:
Selecting an element in the Projects views shows its packages in the Packages view. The Types view shows the types contained in the package selected in the Packages view. The Members view shows the members of a selected type. Functionally, the Members view is comparable to the Outline view used in the normal Java perspective. Selecting an element in the Members view reveals the element in the editor. If there isn't an editor open for the element, double-clicking on the element will open a corresponding editor.
All four views are by default linked to the active editor. This means that the views will adjust their content and their selection according to the file presented in the active editor. The following steps illustrate this behavior:
1. 2. 3.
Select junit.extensions in the Packages view. Open type TestSetup in the editor by double-clicking it in the Types view. Now give back focus to the editor opened on file TestCase.java by clicking on the editor tab. The Packages, Types and Members view adjust their content and selections to reflect the active editor. The Packages view's selection is set to junit.framework and the Types view shows the content of the junit.framework packages. In addition, the type TestCase is selected.
Functionally, the Java browsing perspective is fully comparable to the Java perspective. The context menus for projects, packages, types, etc. and the global menu and tool bar are the same. Therefore activating these functions is analogous to activating them in the Java perspective. Next Section: Writing and running JUnit tests
----------------------------------------------------------------------------Java development user guide > Getting Started > Basic tutorial
Writing Tests
Create a project "JUnitTest". Now you can write your first test. You implement the test in a subclass of TestCase. You can do so either using the standard Class wizard or the specialized Test Case wizard:
1. 2. Open the New wizard (File > New > JUnit Test Case). Select New JUnit 3 test and enter "TestFailure" as the name of your test class:
Note: If you want to use JUnit 4 tests you have to make sure that your compiler compliance is set to 1.5.
3. 4. You will see a warning message asking you to add the junit library to the build path. Use the Click here link to add the junit library automatically. Click Finish to create the test class.
Add a test method that fails to the class TestFailure. A quick way to enter a test method is with the test template. To do so, place the cursor inside the class declaration. Type "test" followed by Ctrl+Space to activate code assist and select the "test" template. Change the name of the created method to testFailure and invoke the fail() method.
public void testFailure() throws Exception { fail(); }
Running Tests
To run TestFailure hit the run button in the toolbar. It will automatically run as JUnit Test. You can inspect the test results in the JUnit view. This view shows you the test run progress and status:
The view is shown in the current perspective whenever you start a test run. A convenient arrangement for the JUnit view is to dock it as a fast view. The JUnit view has two tabs: one shows you a list of failures and the other shows you the full test suite as a tree. You can navigate from a failure to the corresponding source by double clicking the corresponding line in the failure trace. Dock the JUnit view as a fast view, remove the fail() statement in the method testFailure() so that the test passes and rerun the test again. You can rerun a test either by clicking the Rerun button in the view's tool bar or you can re-run the program that was last launched by activating the Run drop down. This time the test should succeed. Because the test was successful, the JUnit view doesn't pop up, but the success indicator shows on the JUnit view icon and the status line shows the test result. As a reminder to rerun your tests the view icon is decorated by a "*" whenever you change the workspace contents after the run. - A successful test run - A successful test run, but the workspace contents have changed since the last test run. In addition to running a test case as described above you can also:
Run all tests inside a project, source folder, or package Select a project, package or source folder and run all the included tests with Run as > JUnit Test. This command finds all tests inside a project, source folder or package and executes them. Run a single test method Select a test method in the Outline or Package Explorer and with Run as > JUnit Test the selected test method will be run. Rerun a single test Select a test in the JUnit view and execute Run from the context menu.
In this dialog you can specify the test to be run, its arguments, its run-time class path, and the Java run-time environment.
A JUnit launch configuration has a "keep alive" option. If your Java virtual machine supports "hot code replacement" you can fix the code and rerun the test without restarting the full test run. To enable this option select the Keep JUnit running after a test run when debugging checkbox in the JUnit launch configuration.
4.
Select the classes that should be included in the suite. We currently have a single test class only, but you can add to the suite later.
You can add or remove test classes from the test suite in two ways:
Manually by editing the test suite file By re-running the wizard and selecting the new set of test classes.
Note: the wizard puts 2 markers, //$JUnit-BEGIN$ and //$JUnit-END$, into the created Test suite class, which allows the wizard to update existing test suite classes. Editing code between the markers is not recommended. Next Section: Project configuration tutorial
----------------------------------------------------------------------------Java development user guide > Getting Started > Project configuration tutorial
The source files for a product are laid out in one directory "src". The class files are in another directory "bin".
Click Window > Open Perspective > Other... > Java to change to the Java perspective. Click File > New > Other... > Java Project to open the New Java Project wizard. Type "Product" in the Project name field. In Project layout group, change selection to Create separate source and output folders. In Contents group, change selection to Create project from existing source. Click Browse... and choose the Product directory on drive D:.
5.
Click Next. Ensure that the source and output folders are detected.
Warning: If the Scrub output folders when cleaning projects preference in the Output folder section of the Java > Compiler > Building preference page is checked, clicking Finish will scrub the "bin" directory in the file system before generating the class files. Click Finish. 7. You now have a Java project with a "src" folder which contains the sources of the "Product" directory.
6.
Note: This solution creates a ".project" file and a ".classpath" file in the "Product" directory. If you do not wish to have these files in the "Product" directory, you should use linked folders as shown in the Sibling products in a common source tree section. Next Section: Organizing sources
----------------------------------------------------------------------------Java development user guide > Getting Started > Project configuration tutorial
Organizing sources
Layout on file system
In this section, you will create a new Java project and organize your sources in separate folders. This will prepare you for handling more complex layouts. Let's assume you want to put your sources in one folder and your tests in another folder:
Click Window > Open Perspective > Other... > Java to change to the Java perspective. Click File > New > Other... > Java Project to open the New Java Project wizard. Type "MyProject" in the Project name field. In Project layout group, change selection to Create separate source and output folders and edit Configure default... to modify Source folder name from "src" to "sources".
5.
Click OK to return on New Java Project wizard and then click Next.
6. 7.
To add another source folder to your project, click Create new source folder link in Details pane or button in view bar. In New Source Folder dialog, type "tests" in the Folder name field.
Click Finish to validate and close the dialog. 9. Your project setup now looks as follows:
8.
10. 11.
Click Finish You now have a Java project with two source folders: sources and tests. You can start adding classes to these folders or you can copy them using drag and drop.
----------------------------------------------------------------------------Java development user guide > Getting Started > Project configuration tutorial
The source files for products are laid out in one big directory that is version and configuration managed outside Eclipse. The source directory contains two siblings directories Product1 and Product2.
Click Window > Open Perspective > Other... > Java to change to the Java perspective. Click File > New > Other... > Java Project to open the New Java Project wizard. Type "Product1" in the Project name field. Click Next.
4. On the next page, Select "Product1" source folder. Click Link additional source link in Details pane or button in view bar.
5.
In Link Source dialog click Browse.... and choose the D:\AllProducts\Product1\JavaSourceFiles directory.
Click Finish to validate and close the dialog. 7. Your project source setup now looks as follows:
6.
Click Finish. 9. Repeat steps 2 to 8 for "Product2". 10. You now have two Java projects which respectively contain the sources of "Product1" and "Product2".
8.
----------------------------------------------------------------------------Java development user guide > Getting Started > Project configuration tutorial
The Java source files for products are all held in a single main directory. Products are separated into four siblings packages Product1, Product2, Product3 and Product4.
Click Window > Open Perspective > Other... > Java to change to the Java perspective. Click File > New > Other... > Java Project to open the New Java Project wizard. Type "Product1" in the Project name field. Click Next.
4. On the next page, Select "Product1" source folder. Click Link additional source link in Details pane or button in view bar.
5.
In Link Source click Browse.... and choose the D:\AllJavaSourceFiles directory. Type "src" in Folder name.
6. 7.
Click Finish to validate and close the dialog. Expand the "src" source folder. Select the three last packages and exclude them from build path using either Exclude from build path link or Exclude popup-menu item.
Edit "Product2" project properties and go on Java Build Path page. In Source tab, expand "Product2/src" source folder, select Excluded and click Edit....
11.
13.
Click OK to enter the change. Click Finish to validate and close Inclusion and Exclusion Patterns dialog. Click OK again to validate "Product2" project properties changes.
14. You now have two Java projects which respectively contain the sources of "product1", "product2".
----------------------------------------------------------------------------Java development user guide > Getting Started > Project configuration tutorial
The Java source files for a product are laid out in a package directory. Source files of tests are laid out in a nested package directory.
Click Window > Open Perspective > Other... > Java to change to the Java perspective. Click File > New > Other... > Java Project to open the New Java Project wizard. Type "Product1" in the Project name field. Click Next.
4. On the next page, Select "Product1" source folder. Click Link additional source link in Details pane or button in view bar.
5.
In Link Source click Browse.... and choose the D:\Product1\JavaSourceFiles directory. Type "src" in the Folder name field.
6. 7.
Click Finish to validate and close the dialog. Expand the "src" source folder. Select the empty package "tests" and set it as source folder using either Use as Source Folder popup-menu item or button in view bar.
9. 10.
Click Finish. You now have a Java project with two source folders: "src" and "src/tests" which contain respectively the D:\Product1\JavaSourceFiles directory and the D:\Product1\JavaSourceFiles\tests directory.
----------------------------------------------------------------------------Java development user guide > Getting Started > Project configuration tutorial
The Java source files for two products require a common framework. Projects and common framework are in separate directories which have their own source and output folders.
Click Window > Open Perspective > Other... > Java to change to the Java perspective. Click File > New > Other... > Java Project to open the New Java Project wizard. Type "Product1" in the Project name field. Click Next.
4. On the next page, Select "Product1" source folder. Click Link additional source link in Details pane or button in view bar.
5.
In Link Source click Browse.... and choose the D:\Product1\JavaSourceFiles directory. Type "src" in the Folder name field.
6. 7.
Click Finish to validate and close the dialog. Again, Select "Product1" and click Link additional source link in Details pane or button in view bar.
8.
In Link Source click Browse.... and choose the D:\Framework\JavaSourceFiles directory. Type "src-common" in the Folder name field.
9.
Click Finish to validate and close the dialog. Your project source setup now looks as follows:
Click Finish. Create project "Product2" repeating steps 2 to 5 choosing D:\Product2\JavaSourceFiles directory for source folder instead. 12. Click on Finish to create the project immediately. 13. Now, we'll see how to add a linked source folder when project is already created in workspace...
10. 11.
Edit project "Product2" properties and select Java Builder Path page. On Source tab, click Link Source....
14.
In Link Source click Browse.... and choose the D:\Framework\JavaSourceFiles directory. Type "src-common" in the Folder name field.
15.
Click Finish to validate and close the dialog. Click OK to apply project "Product2" properties changes.
16. You now have two Java projects which respectively contain the sources of "Product1" and "Product2" and which are using the sources of "Framework".
Note: Files in "src-common" are shared. So editing "Common.java" in "Product1" will modify "Common.java" in "Product2". However they are compiled in the context of their respective projects. Two "Common.class" files will be generated; one for each project. If the two projects have different compiler options, then different errors could be reported on each "Common.java" file. Next Section: Product nesting resources in output directory
----------------------------------------------------------------------------Java development user guide > Getting Started > Project configuration tutorial
The Java source files for a product are laid out both in sources and deliverables directories.
All Java class files are laid out in deliverables directory. Project needs to use some libraries located in deliverables/libraries directory:
Click Window > Open Perspective > Other... > Java to change to the Java perspective. Click File > New > Other... > Java Project to open the New Java Project wizard. Type "Product" in the Project name field. Click Next.
4.
On the next page, Type "Product/deliverables" in Default output folder field. Select "Product" source folder. Click Link additional source link in Details pane or button in view bar.
5.
6. 7.
Click Finish to validate and close the dialog. Again, Select "Product" and click Link additional source link in Details pane or button in view bar.
8.
9.
Expand the "Product/deliverables" source folder. Select the "libraries" package and exclude it from build path using either Exclude 'libraries' from build path link or Exclude popupmenu item.
11.
12. Expand "Product" hierarchy to select jar files in "libraries" directory Click OK.
13.
14. You now have a Java project with a "sources" folder and an output folder which contains nested library resources.
----------------------------------------------------------------------------Java development user guide > Getting Started > Project configuration tutorial
The Java source files for a product requires a source framework. "Product" and "Framework" are in separate directories which have their own source and output folders.
Click Window > Open Perspective > Other... > Java to change to the Java perspective. Click File > New > Other... > Java Project to open the New Java Project wizard. Type "Framework" in the Project name field. In Contents group, change selection to Create project from existing source. Click Browse... and choose the D:\Framework directory.
Click Next.
5.
On the next page, verify that directory JavaSourceFiles has been automatically added as source folder. Expand it to preview your project source folder contents:
6. 7.
Click Finish. In Java perspective, type Ctrl+N to open New wizards dialog. Select Java project in the list of wizards and click Next.
8. 9.
On the next page, type "Product" in the Project name field. In Contents group, change selection to Create project from existing source. Click Browse... and choose the D:\Product directory.
10. 11.
Click Next. On the next page, verify that directory JavaSourceFiles has been automatically added as source folder. Expand it to preview your project source folder contents:
12.
Select Projects tab. Click Add...to add a dependency to source framework project...
13.
Click OK to validate and close dialog. 15. Now, let's put access rules on source framework content to authorize, discourage or forbid access to "Framework" source folders, package and classes...
14.
In Projects tab, select "Access rules" of "Framework" depending project. Click Edit....
16.
17.
In Add Access Rule, select "Forbidden" for Resolution. Type "**/forbidden/**" in Rule Pattern field.
Click OK to validate access rule and close dialog. 19. Add another access rule:
18.
Resolution: "Discouraged" and Rule Pattern: "**/internal/**". 20. Your access rules now look as follows:
Click OK to validate these new rules and close dialog. 22. Dependent project has now 2 access rules set.
21.
Click Finish. 24. You now have a Java project which contains the source of "Product" and which is using the source of "Framework".
23.
Some packages of the project "Framework" are restricted and if you try to import them, compiler displays either warnings or errors depending on your restriction level:
Java projects
document, we will introduce some of the more interesting capabilities Eclipse users will find when working with J2SE 5.0. Note that both version numbers '1.5' and '5.0' are used to identify the release of the Java 2 Platform Standard Edition. Version '5.0' is the product version, while '1.5' is the developer version and also used for the compliance level.
Prerequisites
In order to develop code compliant with J2SE 5.0, you will need a J2SE 5.0 or J2SE 6.0 Java Runtime Environment (JRE). If you start Eclipse for the first time using a J2SE 5.0 JRE, then it will use it by default. Otherwise, you will need to use the Java > Installed JREs preference page to register it with Eclipse. This document introduces some of the new language features in J2SE 5.0 very briefly, but it is not a proper tutorial for these features. See here for more information.
To convert an existing J2SE 1.4 project to J2SE 5.0, you can simply: 1. 2. 3. Make sure you have a J2SE 5.0 JRE installed. Start using the 5.0 features in your code. When a compiler error is flagged, use Quick Fix to update the project's compliance level:
4.
For more fine-tuned control, the compiler compliance level can be set globally for a workspace (with the Java > Compiler preference page) or individually for each project (from the project's context menu, choose Properties > Java Compiler).
Projects with different compliance levels can co-exist in the workspace, and depend on each other. You can also fine-tune the kinds of compiler warnings and errors produced for each project using Properties > Java Compiler > Errors/Warnings. The Generic Types and the Annotations section contain options added for J2SE 5.0.
Generic Types
Generic types allow objects of the same class to safely operate on objects of different types. For example, they allow compile-time assurances that a List<String> always contains Strings, and a List<Integer> always contains Integers.
Anywhere that Eclipse handles a non-generic type, it can handle a generic type:
Generic types can be safely renamed. Type variables can be safely renamed.
Generic methods can be safely extracted from / inlined into generic code. Code assist can automatically insert appropriate type parameters in parameterized types.
In addition, a new refactoring has been added: Infer Generic Type Arguments can infer type parameters for every type reference in a class, a package, or an entire project.
Eclipse provides new options when searching for references to generic types. Consider this example:
Selecting the reference to List<Integer> and using Search > References > Project from the context menu will highlight the List types on all four lines:
Filter Incompatible Type Arguments leaves only references to types that are assignmentcompatible with the selected type:
Filter Inexact Type Arguments leaves only type references with the exact same signature:
Annotations
Annotations attach metadata about how Java types and methods are used and documented to the Java source and can then affect compilation or be queried at run-time. For example, @Override will trigger a compiler warning if the annotated method does not override a method in a superclass:
Everything you can do with a Java type, you can do with an annotation:
Create new annotations using New > Annotation Refactor: rename, move, change signatures of members, etc. Search for occurrences Use code assist to fill in names and values
A very useful annotation with full support in Eclipse is @SuppressWarnings. For example, consider a private method that is currently unused, but you'd rather not delete:
Selecting the quick fix adds the annotation. The Eclipse compiler honors the annotation by removing the warning on foo:
Enumerations
Enumerations are types that are instantiated at runtime by a known, finite set of objects:
Create new enumerations using New > Enum Refactor: rename, move, rename constants, etc. Search for occurrences Use code assist to fill in constants
Autoboxing
Autoboxing and auto unboxing allow for elegant syntax when primitive types are assigned to or retrieved from Object references:
Eclipse's source manipulation features handle autoboxing seamlessly, giving the correct types to new local variables and correct code assists. For code understanding, it is also possible to flag instances of autoboxing or autounboxing conversions:
mark them as compiler warnings or errors (Boxing and unboxing conversions in the Potential Programming Problems section of the Java > Compiler > Errors/Warnings preference page) highlight them using syntax coloring (via the Java > Auto(un)boxed expressions section of the Java > Editor > Syntax Coloring preference page):
Eclipse also provides a "Convert to enhanced for loop" quick-assist to upgrade 1.4-style for loops where possible.
Static Imports
Static imports allow you to use static fields and methods from other classes without qualification. Content assist in the Java editor can suggest such static members and adds a static import when required. To get such proposals, configure the static import favorites on the Java > Editor > Content Assist > Favorites preference page.
Clean Up action o Add missing @Override and @Deprecated annotations o Convert for loops to enhanced Infer Generic Type Arguments refactoring
Happy coding!
Concepts
Contents
Java Projects Java Builder Java Perspectives Java Views Java Editor Quick Fix and Assist Templates Java Search Refactoring Support Debugger Scrapbook Local Debugging Remote Debugging Breakpoints String Externalization
Java Projects
A Java project contains source code and related files for building a Java program. It has an associated Java builder that can incrementally compile Java source files as they are changed. A Java project also maintains a model of its contents. This model includes information about the type hierarchy, references and declarations of Java elements. This information is constantly updated as the user changes the Java source code. The updating of the internal Java project model is independent of the Java builder; in particular, when performing code modifications, if auto-build is turned off, the model will still reflect the present project contents. You can organize Java projects in two different ways:
Using the project as the source container. This is the recommended organization for simple projects. Using source folders inside the project as the source container. This is the recommended organization for more complex projects. It allows you to subdivide packages into groups.
Java builder
Java Builder
The Java builder builds Java programs using its own compiler (the Eclipse Compiler for Java) that implements the Java Language Specification. The Java builder can build programs incrementally as individual Java files are saved. Note that the Eclipse Compiler for Java can also be invoked using Ant as described in the Using the ant javac adapter section of Compiling Java code Problems detected by the compiler are classified as either warnings or errors. The existence of a warning does not affect the execution of the program; the code executes as if it were written correctly. Compile-time errors (as specified by the Java Language Specification) are always reported as errors by the Java compiler. For some other types of problems you can, however, specify if you want the Java compiler to report them as warnings, errors or to ignore them. To change the default settings, use the Java > Compiler > Errors/Warnings preference page. The Java compiler can create CLASS files even in presence of compilation errors. However, in the case of serious errors (for example, references to inconsistent binaries, most likely related to an invalid build path), the Java builder does not produce any CLASS files.
Build classpath
Build Classpath
The build classpath specifies which Java source files and resource files in a project are considered by the Java builder and specifies how to find types outside of the project. The Java builder compiles the Java source files into the output folder and also copies the resources into it. The build classpath is specified for each project. In the project properties, it is referred to as the Java Build Path
Java builder Classpath variables Inclusion and exclusion patterns Access rules
----------------------------------------------------------------------------Java development user guide > Concepts > Java Builder > Build Classpath
'*' matches zero or more characters, '?' matches one character. '/' is used to separate folders: This means the first segment in the pattern is matched against the most outer folder name in the path to match, the second segment with the second, and so on. '**' matches any number of folders
----------------------------------------------------------------------------Java development user guide > Concepts > Java Builder > Build Classpath
Access Rules
Access rules can be added to build classpath entries to specify which types in the given entry can be accessed and which not. If the compiler detects a type access to a type that should not be accessed, it will create a problem marker.
Non-accessible rules define types that must not be referenced. The compiler typically creates an error marker for accesses to these types. Discouraged rules define types that should not be referenced. The compiler typically creates a warning marker for accesses to these types. Accessible rules define types that can be referenced.
Each rule consist of a pattern (same format as ANT patterns) and one of the rule types listed above. Each classpath entry can have any number of rules defined. The compiler will process the list in the order defined and take the first matching rule. The severity of the problem marker generated for accesses to 'Non-accessible' and 'Discouraged' type can be configured on the Java compiler's Error/Warnings preference page.
Java builder Classpath variable Inclusion and exclusion patterns Access rules
----------------------------------------------------------------------------Java development user guide > Concepts > Java Builder > Build Classpath
Classpath Variables
The build path for a Java project can include source code files, other Java projects, folders containing class files and JAR files. JAR files can be specified using file system paths, or by using variables that refer to locations on the network. Classpath variables allow you to avoid references to the location of a JAR file or folders on your local file system. By using a classpath variable, you can specify a JAR file or folder using only a variable name, such as JRE_LIB, rather than specifying the location on your workstation. In this way, you can share build paths across teams and define the variables to refer to the correct location for your particular computer.
Java builder Classpath variable Inclusion and exclusion patterns Access rules
Java Perspectives
The Java development tools contribute the following perspectives to the workbench:
Java
A perspective designed for working with Java projects. It consists of an editor area and the following views:
Package Explorer Hierarchy Outline Problems Javadoc Declaration
Java Browsing
A perspective designed for browsing the structure of Java projects. It consists of an editor area and the following views:
Projects Packages Types Members
Debug
A perspective designed for debugging your Java program. It includes an editor area and the following views.
Debug Breakpoints Variables Expressions Outline Console Tasks
Java views
Debug view Display view Expressions view Java outline Package explorer view Type hierarchy view Variables view
Java Views
The Java development tools contribute the following views to the workbench:
Hierarchy View
The Hierarchy view allows you to look at the complete hierarchy for a type, only its subtypes, or only its supertypes. You can also open the hierarchy on a project, source folder or package.
Projects View
The Projects view shows Java projects, source folders, external and internal libraries. Note: source folders and libraries (both internal and external) presented in this view are not expandable. When they are selected, their contents are shown in the Packages view.
Packages View
The Packages view shows a list of Java packages from the currently selected Java projects, source folders or libraries. Typically, the Projects view is used to make this selection.
Types View
The Types view shows a list of Java types from the currently selected packages. Typically, the Packages view is used to make this selection.
Members View
The Members shows the content of a type, compilation unit or CLASS file. Typically, the Types view is used to make this selection.
View Customization
Both the appearance and behavior of the Java views can be customized.
Filtering Sorting Java element decorations Presentation options
Java perspectives
Breakpoints view Console view Debug view Display view Expressions view Java outline Package explorer view Type hierarchy view Call hierarchy view Variables view Views and editors
Filtering Members
Several Java views (e.g. Outline, Type Hierarchy, Members) offer filtering of members (fields, types and methods). The filters are available as toolbar buttons or as view menu items, depending on the view. There are 3 member filters:
Hide Fields: when activated, this filter causes all fields to be removed from the view. Hide Static Fields and Methods: when activated, this filter causes all static members to be removed from the view. Hide Non-Public Members: when activated, this filter causes all non-public members to be removed from the view.
Additionally, the Package Explorer view can display or hide all elements inside compilation units.
To show or hide members in the Package Explorer view, select or clear the Show members in Package Explorer checkbox in the Java > Appearance preference page.
Package explorer
Toggle on the Sort toolbar button in the view toolbar. The sorting order can be configured on the on the Java > Appearance > Members Sort Order preference page. After the above sorting is performed, members in each group are sorted alphabetically.
To show or hide the Java type indicators, select or clear the Java Type Indicator checkbox in the General > Appearance > Label Decorations preference page.
Clear the Compress all package name segments, except the final segment checkbox on the preference page. Java > Appearance
Select the Compress all package name segments, except the final segment checkbox on the Java > Appearance preference page. Compression patterns control how many characters of each package name segment are displayed. The last segment of a package name is always displayed. A compression pattern of "." indicates that only the separating periods are shown to represent a segment. A digit (n) in a compression pattern represents the first n characters of a package name segment. Examples are the best way to understand compression patterns. The package org.eclipse.jdt would be displayed as follows using the example compression patterns: . 0 2~ 3~ ..jdt jdt or~.ec~.jdt org.ecl~.jdt
Java Editor
The Java editor provides specialized features for editing Java code. Associated with the editor is a Java-specific Outline view, which shows the structure of the active Java compilation unit. It is updated as the user edits the compilation unit. The editor can also show a breadcrumb navigation bar. The breadcrumb shows the parent chain of the element at the current cursor position. It is also updated when the user edits the compilation unit or changes the selection. The Java editor can be opened on binary CLASS files. If a JAR file containing the CLASS files has a source attachment, then the editor shows the corresponding source. The editor includes the following features:
Syntax highlighting Content/code assist Code formatting Import assistance Quick fix Integrated debugging features
The Java editor can be configured to either show an entire compilation unit or a single Java element only. To change the setting, use the toolbar button Show Source of Selected Element Only. The most common way to invoke the Java editor is to open a Java file from the Package explorer using pop-up menus or by clicking the file (single or double-click depending on the user preferences). You can also open the editor by opening Java elements, such as types, methods, or fields, from other views.
Opening an editor for a selected element Viewing runtime exceptions Evaluating expressions
Quick assists Quick fixes Java editor actions Java editor preferences Java outline Java Editor Breadcrumb Views and editors
Set the cursor inside or near the highlight range, and select Quick Fix from the Edit menu or the context menu. Set the cursor inside or near the highlight range, and press Ctrl + 1 Click on the light bulb
Quick fix is also available on a problem entry in the Problem view. The Quick Fix action will open a dialog to select the correction. Note that the light bulb is only a hint. It is possible that even with the light bulb shown, it turns out that no corrections can be offered. A overview of quick fixes available in the Java editor can be found here. Quick Assists are proposals available even if there is no problem or warning. They use the same short cut and action like Quick Fix. Quick assists are used for local code manipulations. See the Quick assist reference for more information.
Java editor
Editor Templates
Templates are a structured description of coding patterns that reoccur in source code. The Java editor supports the use of templates to fill in commonly used source patterns. Templates are inserted using content assist (Ctrl+Space). For example, a common coding pattern is to iterate over the elements of an array using a for loop that indexes into the array. By using a template for this pattern, you can avoid typing in the complete code for the loop. Invoking content assist after typing the word for will present you with a list of possible templates for a for loop. You can choose the appropriate template by name (iterate over array). Selecting this template will insert the code into the editor and position your cursor so that you can edit the details. Templates can contain template variables. Variables mark the editable locations. They can be resolves to a concrete value when the template is evaluated in its context. They can also provide a list of alternative proposals valid at the given location. Many common templates are already defined. These can be viewed with the Java > Editor > Templates preference page. You can also create your own templates or edit the existing ones.
Templates preferences Template variables Template editing Edit menu Java content assist
Java Search
The Java searching support allows you to find declarations, references and occurrences of Java elements (packages, types, methods, fields). Searching is supported by an index that is kept up to date in the background as the resources corresponding to Java elements are changed. The Java search operates on workspaces independent of their build state. For example, searches can be conducted when auto-build is turned off. The following searches can be initiated from the pop-up menus of Java elements or from the Java search dialog: Command References Declarations Implementors Read access Write access Match locations for type references Occurrences in File Description Finds all references to the selected Java element Finds all declarations of the selected Java element Finds all implementors of the selected Java interface Finds all read accesses to the selected Java field Finds all write accesses to the selected Java field Finds all type references at specified locations (in casts, as field type, ...) Finds all occurrences of the selected Java element in its file
The scope of the search is defined as: Workspace - all projects and files in the workspace are included in this search Enclosing Projects - the projects enclosing the currently selected elements Hierarchy - only the type hierarchy of the selected element is included in this search Working Set - only resources that belong to the chosen working set are included in this search
Refactoring Support
The goal of Java program refactoring is to make system-wide code changes without affecting the behavior of the program. The Java tools provide assistance in easily refactoring code. The refactoring tools support a number of transformations described in Martin Fowler's book Refactoring: Improving the Design of Existing Code, Addison Wesley 1999, such as Extract Method, Inline Local Variable, etc.. To get an overview of all offered refactorings look at the Refactor menu. Refactoring commands are also available from the context menus in many views or appear as quick assists. When performing a refactoring operation, you can optionally preview all of the changes resulting from a refactoring action before you choose to carry them out. When previewing a refactoring operation, you will be notified of potential problems and will be presented with a list of the changes the refactoring action will perform. If you do not preview a refactoring operation, the change will be made in its entirety and any resultant problems will be shown. If a problem is detected that does not allow the refactoring to continue, the operation will be halted and a list of problems will be displayed. Refactoring commands are available from the context menus of several Java views (e.g. Package Explorer, Outline) and editors. Many "apparently simple" commands, such as Move and Rename, are actually refactoring operations, since moving and renaming Java elements often require changes in dependent files. Refactorings can not only be performed interactively, but also from refactoring scripts. Most refactorings available in the Refactor menu are stored in the workspace refactoring history in order to be used in refactoring scripts afterwards. The refactoring tools support the creation of refactoring scripts based on refactorings in the workspace refactoring history. Refactoring scripts can then be applied to an arbitrary workspace. Applying a refactoring script launches a refactoring wizard which is able to replay the refactorings as if they had been initiated by the user which originally had created them. Related to refactoring scripts, the refactoring tools offer a refactoring to migrate a JAR File to a newer version, using refactoring information to avoid breaking changes in your workspace after the migration.
Debugger
The Java development toolkit (JDT) includes a debugger that enables you to detect and diagnose errors in your programs running either locally or remotely.
The debugger allows you to control the execution of your program by setting breakpoints, suspending launched programs, stepping through your code, and examining the contents of variables. The debugger has a client/server design so you can debug programs running remotely on other systems in the network as well as programs running locally on your workstation. The debug client runs inside the workbench on your workstation. The debugger server runs on the same system as the program you want to debug. This could be a program launched on your workstation (local debugging) or a program started on a computer that is accessible through a network (remote debugging).
Adding breakpoints Changing debugger launch options Connecting to a remote VM with the Remote Java application launch configuration Disconnecting from a VM Evaluating expressions Launching a Java program Preparing to debug Resuming the execution of suspended threads Running and debugging Suspending threads
Debug preferences Debug view Run menu actions Run and Debug toolbar actions
Scrapbook
The Java development toolkit (JDT) contributes a scrapbook facility that can be used to experiment and evaluate Java code snippets before building a complete Java program. Snippets are edited and evaluated in the Scrapbook page editor, with resultant problems reported in the editor. From a Java scrapbook editor, you can select a code snippet, evaluate it, and display the result as a string. You can also show the object that results from evaluating a code snippet in the debuggers' Expressions View.
Creating a Java scrapbook page Displaying the result of evaluating an expression Inspecting the result of evaluating an expression
New Java Scrapbook Page wizard Java Scrapbook page Expressions view
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging
Local Debugging
The Java debugger has a client/server design so that it can be used to debug programs that run locally (on the same workstation as the debugger) or remotely (on another computer on the network). Local debugging is the simplest and most common kind of debugging. After you have finished editing and building your Java program, you can launch the program on your workstation using the Run > Debug Configurations... menu item on the workbench. Launching the program in this way will establish a connection between the debugger client and the Java program that you are launching. You may then use breakpoints, stepping, or expression evaluation to debug your program.
Breakpoints
Adding breakpoints Resuming the execution of suspended threads Running and debugging Suspending threads
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging
Remote Debugging
The client/server design of the Java debugger allows you to launch a Java program from computer on your network and debug it from the workstation running the platform. This is particularly useful when you are developing a program for a device that cannot host the development platform. It is also useful when debugging programs on dedicated machines such as web servers. Note: To use remote debugging, you must be using a Java VM that supports this feature. To debug a program remotely, you must be able to launch the program in debug mode on the remote machine so that it will wait for a connection from your debugger. The specific technique for launching the program and connecting the debugger are VM-specific. The basic steps are as follows: Ensure that you are building your Java program with available debug information. (You can control these attributes from the Java > Compiler preference page). 2. After you build your Java program, install it to the target computer. This involves copying the .CLASS files or .JAR files to the appropriate location on the remote computer. 3. Invoke the Java program on the remote computer using the appropriate VM arguments to specify debug mode and a communication port for the debugger. 4. Start the debugger using a remote launch configuration and specify the address and port of the remote computer.
1.
When setting up the remote launch configuration there are a few items to take note of:
You must ensure you enter the correct hostname i.e. the name of the remote computer where you are currently running your code. The hostname can also be the IP address of the remote machine, for example using 127.0.0.1 instead of localhost. The port number must be the number of the port on the remote machine.
Certain Java VMs support another way of starting a remote debug session. In this alternative connection type, the debugger is launched first. The debugger then waits and listens for the VM to connect to it. To debug this way, you must properly configure and launch a remote debug session, then launch the VM, specifying the location of your waiting debugger. For more information, see Using the remote Java application launch configuration.
Breakpoints
A breakpoint suspends the execution of a program at the location where the breakpoint is set. Breakpoints can be enabled and disabled via the context menu in the Breakpoints View, or via the context menu in the Java Editor ruler.
An enabled breakpoint causes a thread to suspend whenever the breakpoint is encountered. Enabled breakpoints are drawn with a blue circle [ ] and have a checkmark overlay once successfully installed. A breakpoint can only be installed when the class the breakpoint is located in has been loaded by the VM. A disabled breakpoint will not cause threads to suspend. Disabled breakpoints are drawn with a white circle [ ].
Breakpoints are displayed in the vertical editor ruler and in the Breakpoints view.
Adding breakpoints Resuming the execution of suspended threads Running and debugging Suspending threads
Debug preferences Debug view Run menu actions Run and debug toolbar actions Breakpoints view
String Externalization
The Java tools help you to develop applications that can be run on international platforms. An important facet of designing a program for use in different countries is the localization, or externalization, of text that is displayed by the program. By externalizing strings, the text can be translated for different countries and languages without rebuilding the Java program. The JDT provides the following support for internationalization and string externalization:
A compiler option lets you mark non-externalized strings as compile-time warnings or errors. o See the Non-externalized strings option in the Code style section of the Java > Compiler > Errors/Warnings preference page. Tools that allow you to find strings that have not been externalized.
A wizard that will guide you through externalizing the strings. Tools that help you to find unused and incorrectly used keys for strings located in property files.
Comments can be used to denote strings that should not be externalized and should not result in compile-time warnings or errors. These comments are of form //$NON-NLS-n$ where n is the 1based index of the string in a line of code. Additional information about internationalized applications can be found in the following documents:
http://eclipse.org/articles/Article-Internationalization/how2I18n.html http://java.sun.com/docs/books/tutorial/i18n/intro/index.html
Finding strings to externalize Finding unused and incorrectly used keys in property files
Tasks
Contents
Customizing the Debugger and Console Creating JAR Files Using the Local History Externalizing Strings Navigating the Workbench Working with JREs Running and Debugging Using the Scrapbook Using the Formatter Application
Changing the active perspective when launching Changing the appearance of the console view
----------------------------------------------------------------------------Java development user guide > Tasks > Customizing the Debugger and Console
Open the Run/Debug > Perspectives preference page. Select the Always option for the Open the associated perspective when launching preference. This will cause the perspective associated with a program to become active whenever it is launched.
Open the Run/Debug > Perspectives preference page. Select the Always option for the Open the associated perspective when an application suspends preference. This will cause the perspective associated with a program to become active whenever a program suspends.
To associate a particular perspective with a program, do the following: Open the Run/Debug > Perspectives preference page. Select the type of application that you would like to associate a perspective with (for example, Java Application). 3. For each launch mode, select the desired perspective using the combo box. This will cause the perspective you choose to become active based on your preference settings (i.e. when a program is launched and/or when it suspends).
1. 2.
If the specified perspective is not open at the time it needs to be activated, that perspective is created.
----------------------------------------------------------------------------Java development user guide > Tasks > Customizing the Debugger and Console
Open the General > Appearance > Colors and Fonts preference page. Select Console font from the Debug category and use the Change... button to change the font. (The Detail Pane Text Font can be used to change the font of the debugger's default Detail Pane).
----------------------------------------------------------------------------Java development user guide > Tasks > Creating JAR Files
Setting advanced options Defining the JAR file's manifest Regenerating a JAR file
----------------------------------------------------------------------------Java development user guide > Tasks > Creating JAR Files
Creating a new JAR file Defining the JAR file's manifest Regenerating a JAR file
----------------------------------------------------------------------------Java development user guide > Tasks > Creating JAR Files
6.
7. 8.
Click the Browse button next to the Main class field to specify the entry point for your applications. Note: If your class is not in the list, then you forgot to select it at the beginning. Click Finish. This will create the JAR, and optionally a JAR description and a manifest file.
Creating a new JAR file Setting advanced options Regenerating a JAR file
----------------------------------------------------------------------------Java development user guide > Tasks > Creating JAR Files
A file can be replaced with an edition from the local history in the Package Explorer view.
The JDT allows you to compare and/or replace individual Java elements (types and their members) with editions from the local history. The JDT allows you to restore Java elements (and files) deleted from the workbench that have been kept in the local history.
Note: Files and Java elements such as types and their members change in time. A 'snapshot' of what they look like a point in time (as saved in the local history) is called an edition.
Replacing a Java element with a local history edition Comparing a Java element with a local history edition Restoring a deleted workbench element
Package explorer
----------------------------------------------------------------------------Java development user guide > Tasks > Using the Local History
Java outline
----------------------------------------------------------------------------Java development user guide > Tasks > Using the Local History
Java outline
----------------------------------------------------------------------------Java development user guide > Tasks > Using the Local History
1. Ensure that a Java view that show Java elements inside files (such as the Outline view) is visible. 2. Open the compilation unit to which you want to add a previously removed Java element from the local history. 3. Activate the editor by clicking its tab in the editor area, and the Java view shows the content of the Java file. 4. In the Java view, select the element to whose container type you want to restore the deleted element. 5. From the type's pop-up menu in the Java view, select Restore from Local History. 6. In the upper left pane of the resulting dialog, all available editions of the selected element in the local history are displayed. 7. In the left pane check all elements that you want to replace. 8. For every checked element select an edition in the right hand pane and view its content in the bottom pane. 9. When you have identified the edition that you want to restore, press Restore. The local history editions are loaded into the editor.
Java editor
Java outline
Externalizing Strings
Contents
Finding strings to externalize Finding unused and incorrectly used keys in property files ----------------------------------------------------------------------------Java development user guide > Tasks > Externalizing Strings
In a Java view (e.g. Package Explorer), select a set of packages, source folders or projects. From the menu bar, select Source > Externalize Strings... A dialog comes up with a list of all compilation units that have some non-externalized strings
In the dialog, you can double click on a listed compilation unit or press the Externalize button to open the Externalize Strings wizard
String externalization
in a Java view (e.g. Package Explorer), select a set of packages, source folders, projects, message property files, or resource bundle accessor classes from the menu bar, select Source > Find Broken Externalized Strings
After the search is finished, the Search Result view displays a list of unused keys in the propertie files and all incorrect references to non-existing keys.
String externalization
Opening an editor for a selected element Showing an element in the Package Explorer view Opening a type in the Package Explorer view Opening an editor on a type Opening a package
----------------------------------------------------------------------------Java development user guide > Tasks > Navigating the Workbench
If there are multiple definitions of the same name, a dialog is shown, and you can select one definition that you want to open. An editor opens containing the selected element.
Java editor
----------------------------------------------------------------------------Java development user guide > Tasks > Navigating the Workbench
1. Select a Java element or activate a Java editor. 2. From the menu bar, select Navigate > Show In > Package Explorer. If the Package Explorer is not already open, then it opens in the current perspective. The workbench navigates to the selected element (or the edited compilation unit). From the Java editor's pop-up menu, select Show In > Package Explorer. The currently edited compilation unit will be revealed.
Note: The element might not be revealed if Package Explorer filters are active or the Show Members in Package Explorer preference is cleared on the Java > Appearance preference page.
Java views
----------------------------------------------------------------------------Java development user guide > Tasks > Navigating the Workbench
3. 4.
From the menu bar, select Navigate > Go To > Type. The Go to Type dialog opens. In the Choose a type field, begin typing an expression to narrow the list of available types, using wildcards as needed. As you type, the list is filtered to display only types that match the current expression. In the Matching items list, select a type. Hint: you can press the Down key to move to the first type. Click OK when you are done. The selected type is displayed in the Package Explorer.
Note: The Goto Type dialog maintains a history of recently opened types. These are shown when the dialog is opened and stay above a separator line when you start to type a filter expression. Note: Revealing may not be possible if Package Explorer filters are applied.
----------------------------------------------------------------------------Java development user guide > Tasks > Navigating the Workbench
3. 4.
Press Ctrl+Shift+T or, select Navigate > Open Type from the menu bar. The Open Type dialog opens. In the Enter type name prefix or pattern field, begin typing an expression to narrow the list of available types, using wildcards as needed. As you type, the list is filtered to display only types that match the current expression. CamelCase notation is also supported; that means you aonly need to enter the capital letters of the type name. In the Matching items list, select a type. Hint: you can press the Down key to move to the first type. Click OK when you are done. An editor opens on the selected type.
Note: The Open Type dialog maintains a history of recently opened types. These are shown when the dialog is opened and stay above a separator line when you start to type a filter expression. Note: If you open a type from a CLASS or JAR file, you will see a special editor showing only method signatures unless you have attached source to it.
Java editor
----------------------------------------------------------------------------Java development user guide > Tasks > Navigating the Workbench
Opening a Package
3.
Select Navigate > Go To > Package from the menu bar. The Go to Package dialog opens. Type a package name in the Choose a package field to narrow the list of available packages, using wildcards as needed. As you type, the list is filtered to display only packages that match the current expression. Select a package from the list, then click OK. The selected package is displayed in the Package Explorer.
Java views
The type of the JRE (e.g. Standard VM or Standard 1.x.x VM) A name The location where the JRE is installed The system libraries containing the Java system classes (like java.lang.Object). Optionally, the system libraries can be associated with the source file containing the source for the classes in the JRE's CLASS files and a javadoc location (URL). Other information needed by the VM to build, run and debug applications.
You can switch the default JRE for the workbench. The default JRE is used by default when building, running, and debugging applications. Alternatively, projects may specify a specific JRE that they should be built and run with.
Adding a new JRE definition Deleting a JRE definition Choosing a default JRE Choosing a JRE for launching a project
----------------------------------------------------------------------------Java development user guide > Tasks > Working with JREs
3.
Open the Java > Installed JREs preference page. Check the box on the line for the JRE that you want to assign as the default JRE in your workbench. If the JRE you want to assign as the default does not appear in the list, you must add it. Click OK.
Note: Changing the default JRE may cause a build to occur if you have auto build enabled (Project > Build Automatically or in the General > Workspace preference page).
Working with JREs Adding a new JRE definition Deleting a JRE definition Choosing a JRE for launching a project
----------------------------------------------------------------------------Java development user guide > Tasks > Working with JREs
Standard VM:
1. 2. 3. 4. In the JRE home field, click Browse... to select a path to the root directory of a JRE installation (usually the directory containing the bin and lib directories for the JRE). You may also type a folder name into this field. In the JRE name field, type a name for the new JRE definition. All JREs of the same type must have a unique name. In the Default VM Arguments field, you can add/edit the default arguments that will be passed to the VM when launching. The default libraries appear for the JRE in the JRE system libraries list. You can modify the libraries as desired. o Source and javadoc locations can be specified for the referenced JARs. The Javadoc location is used by the Javadoc export wizard as a default value and by the 'Open External Javadoc' action. o Jars can be added, removed, and reordered. Click Finish when you are done.
5.
1. 2. 3. 4.
5.
In the Definition home directory field, click File... to select a execution environment description file to load the JRE installation from. You may also type a file path into this field. In the JRE name field, type a name for the new JRE definition. All JREs of the same type must have a unique name. In the Default VM Arguments field, you can add/edit the default arguments that will be passed to the VM when launching. The default libraries appear for the JRE in the JRE system libraries list. You can modify the libraries as desired. o Source and javadoc locations can be specified for the referenced JARs. The Javadoc location is used by the Javadoc export wizard as a default value and by the 'Open External Javadoc' action. o Jars can be added, removed, and reordered. Click Finish when you are done.
Working with JREs Deleting a JRE definition Choosing a default JRE Choosing a JRE for launching a project
----------------------------------------------------------------------------Java development user guide > Tasks > Working with JREs
With a Java Application configuration selected in the Launch Configuration Dialog, select the JRE tab. In the list of available JREs, select the JRE you want to use to launch this configuration and click Apply, then Run or Debug.
Note: Changing the JRE used for running does not affect the way Java source is compiled. You can adjust the build path to compile against custom libraries.
Working with JREs Adding a new JRE definition Deleting a JRE definition Choosing a default JRE
----------------------------------------------------------------------------Java development user guide > Tasks > Working with JREs
Working with JREs Adding a new JRE definition Choosing a default JRE Choosing a JRE for launching a project
In run mode, the program executes, but the execution may not be suspended or examined. In debug mode, execution may be suspended and resumed, variables may be inspected, and expressions may be evaluated.
Changing debugger launch options Choosing a JRE for launching a project Creating a Java scrapbook page Disconnecting from a VM Launching a Java program Local debugging Preparing to debug Re-launching a program Remote debugging Resuming the execution of suspended threads Setting execution arguments Stepping through the execution of a program Suspending threads
Breakpoints
A breakpoint suspends the execution of a program at the location where the breakpoint is set. Breakpoints can be enabled and disabled via the context menu in the Breakpoints View, or via the context menu in the Java Editor ruler.
An enabled breakpoint causes a thread to suspend whenever the breakpoint is encountered. Enabled breakpoints are drawn with a blue circle [ ] and have a checkmark overlay once successfully installed. A breakpoint can only be installed when the class the breakpoint is located in has been loaded by the VM. A disabled breakpoint will not cause threads to suspend. Disabled breakpoints are drawn with a white circle [ ].
Breakpoints are displayed in the vertical editor ruler and in the Breakpoints view.
Adding breakpoints Resuming the execution of suspended threads Running and debugging Suspending threads
Debug preferences Debug view Run menu actions Run and debug toolbar actions Breakpoints view
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Breakpoints
While the breakpoint is enabled, thread execution suspends before that line of code is executed. The debugger selects the thread that has suspended and displays the thread's stack frames. The line where the breakpoint was set is highlighted in the editor in the Debug Perspective.
Applying hit counts Catching Java exceptions Removing breakpoints Enabling and disabling breakpoints Managing conditional breakpoints Setting method breakpoints Stepping through the execution of a program
Breakpoints view ----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Breakpoints
Adding breakpoints Enabling and disabling breakpoints Applying hit counts Catching Java exceptions Managing conditional breakpoints
Breakpoints view
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Breakpoints
To disable a breakpoint in the marker bar of an editor: Open the breakpoint's context menu and select Disable Breakpoint. 2. The breakpoint image will change to a white circle.
1.
To enable the breakpoint in the Breakpoints View: Open the breakpoint's context menu and select Enable, or select the breakpoint's checkbox. 2. The breakpoint image will change back to a blue circle, and its checkbox will be checked.
1.
To enable a breakpoint in the marker bar of an editor: Open the breakpoint's context menu and select Enable Breakpoint. 2. The breakpoint image will change to a white circle.
1.
Applying hit counts Catching Java exceptions Removing breakpoints Setting method breakpoints Managing conditional breakpoints Stepping through the execution of a program
Breakpoints view
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Breakpoints
Method breakpoints can also be setup to break on method exit. In the Breakpoints view, select the breakpoint and toggle the Exit item in its context menu. Method breakpoints can be removed, enabled, and disabled just like line breakpoints.
Breakpoints
Adding breakpoints Removing breakpoints Enabling and disabling breakpoints Applying hit counts Catching Java exceptions
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Breakpoints
thread the nth time it is hit, but never again, until it is re-enabled or the hit count is changed or disabled. To set a hit count on a breakpoint: 1. Select the breakpoint to which a hit count is to be added. 2. From the breakpoint's pop-up menu, select Hit Count. 3. In the Enter the new hit count for the breakpoint field, type the number of times you want to hit the breakpoint before suspending execution. Note: When the breakpoint is hit for the nth time, the thread that hit the breakpoint suspends. The breakpoint is disabled until either it is re-enabled or its hit count is changed.
Breakpoints
Adding breakpoints Removing breakpoints Enabling and disabling breakpoints Setting method breakpoints
Breakpoints view
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Breakpoints
when the result of the expression is true when the result of the expression changes
A conditional expression can contain arbitrary Java code and may contain more than one statement, allowing breakpoint conditions to implement features like tracing. For example, a condition can execute a print statement and then return a hard coded value to never suspend ("System.out.println(...); return false;"). To set a condition on a breakpoint: Find the breakpoint to which an enabling condition is to be applied (in the Breakpoints View or in the editor marker bar). 2. From the breakpoint's pop-up menu, select Breakpoint Properties.... The Breakpoint properties dialog will open. 3. In the properties dialog, check the Enable Condition checkbox. 4. In the Condition field enter the expression for the breakpoint condition. 5. Do one of the following:
1.
6.
If you want the breakpoint to stop every time the condition evaluates to true, select the condition is 'true' option. The expression provided must be a boolean expression. o If you want the breakpoint to stop only when the result of the condition changes, select the value of condition changes option. Select OK to close the dialog and commit the changes. While the breakpoint is enabled, thread execution suspends before that line of code is executed if the breakpoint condition evaluates to true.
o
Adding breakpoints Applying hit counts Catching Java exceptions Removing breakpoints Setting method breakpoints Stepping through the execution of a program
Breakpoints view
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Breakpoints
Choose Add Java Exception Breakpoint from the Breakpoints View or the workbench Run menu.
2.
A dialog listing all of the available exceptions is presented (see the following figure).
3. Type the name of the exception you want to catch or select it from the list. 4. At the bottom of the page, use the checkboxes to specify how you want execution to suspend at locations where the exception is thrown. o Select Caught if you want execution to suspend at locations where the exception is thrown and caught by a catch clause. o Select Uncaught if you want execution to suspend at locations where the exception is uncaught. Note: Exception breakpoints can be enabled and disabled and have hit counts just like regular breakpoints.
Creating Exception Breakpoint Filters Suspending threads Adding breakpoints Removing breakpoints Enabling and disabling breakpoints Setting method breakpoints
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Breakpoints
Using the Filtering properties page there are four ways to add filtering for a Java exception breakpoint:
1. 2. 3. 4. You can select specific threads to restrict the breakpoint to (which must be done while in a debug session) You can use the Add Class button to select a class via the Type Selection Dialog You can use the Add Package button to select a package using a filtered Type Selection Dialog You can use the Add button to define your own pattern to match as a class and/or package filter
There are some rules to follow when creating your own pattern.
1. 2. 3. Your pattern can only contain a '*' at the end Your pattern must be fully qualified, E.g. a.b.c.MyClass Your pattern cannot have spaces in it
Examples
a.b.c* - would match everything in the package a.b.c a.b.c.My* - would match anything in the a.b.c package that started with 'My' My* - would match anything in the default package that started with 'My'
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging
Local Debugging
The Java debugger has a client/server design so that it can be used to debug programs that run locally (on the same workstation as the debugger) or remotely (on another computer on the network).
Local debugging is the simplest and most common kind of debugging. After you have finished editing and building your Java program, you can launch the program on your workstation using the Run > Debug Configurations... menu item on the workbench. Launching the program in this way will establish a connection between the debugger client and the Java program that you are launching. You may then use breakpoints, stepping, or expression evaluation to debug your program.
Breakpoints
Adding breakpoints Resuming the execution of suspended threads Running and debugging Suspending threads
Debug preferences Debug view Run menu actions Run and Debug toolbar actions
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Local Debugging
Preparing to Debug
You can make your programs easier to debug by following these guidelines:
Where possible, do not put multiple statements on a single line, because some debugger features operate on a line basis. For example, you cannot step over or set line breakpoints on more than one statement on the same line. Attach source code to JAR files if you have the source code.
Debug preferences
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Local Debugging
If you want your program to stop in the main method so that you can step through its complete execution, create a Java Application launch configuration and check the Stop in main checkbox on the Main tab. You can also debug a Java program by selecting a project instead of the compilation unit or class file. You will be prompted to select a class from those classes that define a main method. (If only one class with a main method is found in the project, that class is launched as if you selected it.)
Connecting to a remote VM with the Java Remote Application launcher Re-launching a program Running and debugging Setting execution arguments Stepping through the execution of a program
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Local Debugging
Suspending Threads
To suspend an executing thread:
1. 2.
Select the thread in the Debug View. Click the Suspend button [ ] in the view toolbar.
The thread suspends its execution. The current call stack for the thread is displayed, and the current line of execution is highlighted in the editor in the Debug Perspective. When a thread suspends, the top stack frame of the thread is automatically selected. The Variables View shows the stack frame's variables and their values. Complex variables can be further examined by expanding them to show the values of their members. When a thread is suspended and the cursor is hovered over a variable in the Java editor, the value of that variable is displayed.
Catching Java exceptions Evaluating expressions Resuming the execution of suspended threads Stepping through the execution of a program
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Local Debugging
Select the thread or its stack frame in the Debug View. Click the Resume button [ ] in the view toolbar (or press the F8 key).
The thread resumes its execution and stack frames are no longer displayed for the thread. The Variables View is also cleared.
Debugger
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Local Debugging
Step over
1. 2. Select a stack frame in the Debug View. The current line of execution in that stack frame is highlighted in the editor in the Debug Perspective. Click the Step Over button [ ] in the view toolbar, or press the F6 key. The currently-selected line is executed and suspends on the next executable line.
Step into
1. 2. Select a stack frame in the Debug View. The current line of execution in the selected frame is highlighted in the editor in the Debug Perspective. Click the Step Into button [ ] in the view toolbar, or press the F5 key. The next expression on the currently-selected line to be executed is invoked, and execution suspends at the next executable line in the method that is invoked.
Step Return
1. 2. Select a stack frame in the Debug View. The current line of execution in the selected frame is highlighted in the editor in the Debug Perspective. Click the Step Return button [ ] in the view toolbar or press the F7 key. Execution resumes until the next return statement in the current method is executed, and execution suspends on the next executable line.
Run to line
When a thread is suspended, it is possible to resume execution until a specified line is executed. This is a convenient way to suspend execution at a line without setting a breakpoint.
1. 2. Place your cursor on the line at which you want the program to run. Select the Run to Line command [ ] from the pop-up menu or use Ctrl+R. Program execution is resumed and suspends just before the specified line is to be executed.
It is possible that the line will never be hit and that the program will not suspend. Breakpoints and exceptions can cause the thread to suspend before reaching the specified line.
Adding breakpoints Launching a Java program Resuming the execution of suspended threads Running and debugging Setting execution arguments Suspending threads
Debug view
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Local Debugging
Inspecting values
When a stack frame is selected, you can see the visible variables in that stack frame in the Variables View. The Variables view shows the value of primitive types. Complex variables can be examined by expanding them to show their members.
Inspecting Values in the Expressions View Inspecting Values in the Variables View Inspecting Values in other views
-----------------------------------------------------------------------------
Java development user guide > Tasks > Running and Debugging > Local Debugging
Evaluating expressions
When the VM suspends a thread (due to hitting a breakpoint or stepping through code), you can evaluate expressions in the context of a stack frame. 1. Select the stack frame in which an evaluation is to be performed. The evaluation context will be the currently selected variable in the view. If no variable is selected, the selected stack frame will be the context. 2. Expressions can be entered and evaluated in the following areas: o Display View o Detail Pane (in the Expressions View and Variables View) o Java Editor when it is displaying source and it is not read-only 3. Select the expression to be evaluated and select Display, Inspect or Execute from the context pop-up menu. The result of a Display or Inspect evaluation is shown in a popup window. Note that Execute does not display a result - the expression is just executed. 4. The result popup window can be dismissed by clicking outside of the popup window or by pressing Esc. The result can be persisted to the Display view (if Display was chosen) or Expressions view (if Inspect was chosen) by pressing the key sequence shown at the bottom of the popup window. For example, to move the result of an Inspect evaluation to the Expressions view press Ctrl-Shift-I. Note that when the Display action is used from the Display view the result is written to the Display view rather than a popup Note: Evaluations cannot be performed in threads that have been manually suspended.
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging
Remote Debugging
The client/server design of the Java debugger allows you to launch a Java program from computer on your network and debug it from the workstation running the platform. This is particularly useful when you are developing a program for a device that cannot host the development platform. It is also useful when debugging programs on dedicated machines such as web servers. Note: To use remote debugging, you must be using a Java VM that supports this feature.
To debug a program remotely, you must be able to launch the program in debug mode on the remote machine so that it will wait for a connection from your debugger. The specific technique for launching the program and connecting the debugger are VM-specific. The basic steps are as follows: Ensure that you are building your Java program with available debug information. (You can control these attributes from the Java > Compiler preference page). 2. After you build your Java program, install it to the target computer. This involves copying the .CLASS files or .JAR files to the appropriate location on the remote computer. 3. Invoke the Java program on the remote computer using the appropriate VM arguments to specify debug mode and a communication port for the debugger. 4. Start the debugger using a remote launch configuration and specify the address and port of the remote computer.
1.
When setting up the remote launch configuration there are a few items to take note of:
You must ensure you enter the correct hostname i.e. the name of the remote computer where you are currently running your code. The hostname can also be the IP address of the remote machine, for example using 127.0.0.1 instead of localhost. The port number must be the number of the port on the remote machine.
Certain Java VMs support another way of starting a remote debug session. In this alternative connection type, the debugger is launched first. The debugger then waits and listens for the VM to connect to it. To debug this way, you must properly configure and launch a remote debug session, then launch the VM, specifying the location of your waiting debugger. For more information, see Using the remote Java application launch configuration.
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Remote Debugging
2.
Select Run > Debug Configurations... from the workbench menu bar (or Debug Configurations... from the drop-down menu on the Debug tool bar button) to show the launch configuration dialog. Select the Remote Java Application in the list of configuration types on the left.
3. 4. 5.
6.
7. 8.
9.
Click the New toolbar button. A new remote launch configuration is created and three tabs are shown: Connect, Source, and Common. In the Project field of the Connect tab, type or browse to select the project to use as a reference for the launch (for source lookup). A project does not need to be specified. The Connection Type field of the Connect tab allows you to choose how you will connect to the virtual machine. In most cases, you will be attaching to the vm at a specific location, in which case select Standard (Socket Attach). the rest of these instructions assume you have chosen this option. The Standard (Socket Listen) connection type creates a launch that will listen for incoming connections from a remote VM. You will need to specify a port that the launch will listen at. In the Host field of the Connect tab, type the IP address or domain name of the host where the Java program is running. If the program is running on the same machine as the workbench, type localhost. In the Port field of the Connect tab, type the port where the remote VM is accepting connections. Generally, this port is specified when the remote VM is launched. The Allow termination of remote VM flag is a toggle that determines whether the Terminate command is enabled in the debugger. Select this option if you want to be able to terminate the VM to which you are connecting. Click Debug. The launch attempts to connect to a VM at the specified address and port, and the result is displayed in the Debug view. If the launcher is unable to connect to a VM at the specified address, an error message appears.
Specific instructions for setting up the remote VM should be obtained from your VM provider.
Debug view
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Remote Debugging
Disconnecting from a VM
To disconnect from a VM that was connected to with a Remote Java Application launch configuration:
1. 2.
In the Debug View, select the launch. Click the Disconnect button [ ] in the view toolbar.
Communication with the VM is terminated, and all threads in the remote VM are resumed. Although the remote VM continues to execute, the debug session is now terminated.
Debugger
Connecting to a remote VM with the Remote Java application launch configuration Running and debugging
Debug view
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging
2.
Select Run > Run Configurations... or Run > Debug Configurations... from the workbench menu bar. This opens a dialog that lets you create, modify, and delete launch configurations of different types. Select Java Application in the left hand list of launch configuration types, and press the New button in the toolbar. This will create a new launch configuration for a Java application. The tabs on the right hand side allow you control specific aspects of the launch. The Main tab defines the class to be launched. Enter the name of the project containing the class to launch in the project field, and the fully qualified name of the main class in the Main class field. Check the Stop in main checkbox if you want the program to stop in the main method whenever the program is launched in debug mode. Note: You do not have to specify a project, but doing so allows a default classpath, source lookup path, and JRE to be chosen. The Arguments tab defines the arguments to be passed to the application and to the virtual machine (if any). You can also specify the working directory to be used by the launched application. The JRE tab defines the JRE used to run or debug the application. You can select a JRE from the already defined JREs, or define a new JRE. The Classpath tab defines the location of class files used when running or debugging an application. By default, the user and bootstrap class locations are derived from the associated project's build path. You may override these settings here. The Source tab defines the location of source files used to display source when debugging a Java application. By default, these settings are derived from the associated project's build path. You may override these settings here. The Environment tab defines the environment variable values to use when running or debugging a Java application. By default, the environment is inherited from the Eclipse runtime. You may override or append to the inherited environment. The Common tab defines general information about the launch configuration. You may choose to store the launch configuration in a specific file
and specify which perspectives become active when the launch configuration is launched.
Choosing a JRE for launching a project Launching a Java program Setting execution arguments Changing debugger launch options
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging
3.
In the Package Explorer, select the Java compilation unit or class file with the main method you want to launch. Press the Run [ ] button in the workbench toolbar or select Run > Run from the workbench menu bar. Alternatively, select Run As > Java Application in the Package Explorer pop-up menu, or select Run > Run As > Java Application in the workbench menu bar, or select Run As > Java Application in the drop-down menu on the Run tool bar button. Your program is now launched, and text output is shown in the Console View.
You can also launch a Java program by selecting a project instead of the compilation unit or class file. You will be prompted to select a class from those classes that define a main method. (If only one class with a main method is found in the project, that class is launched as if you selected it.)
Re-launching a program Running and debugging Setting execution arguments Stepping through the execution of a program
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging
You can also launch a Java applet by selecting a project instead of the compilation unit or class file. You will be prompted to select a class from those classes that extend Applet. (If only one applet class is found in the project, that class is launched as if you selected it.)
Debugger
Re-launching a program Running and debugging Stepping through the execution of a program
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging
If you want to specify execution arguments for your program, you must define a launch configuration that specifies the arguments.
1.
2. 3.
4.
Select Run > Run Configurations... or Run > Debug Configurations... from the workbench Run menu to open the list of launch configurations. Launch configurations for Java programs are shown underneath Java Application in this list. Select an existing configuration or create a new launch configuration by pushing the New button after selecting Java Application. On the Arguments tab for the configuration, you can specify the following fields as necessary: o Program Arguments: Application-specific values that your code is expecting (a user name or a URL for locating help files, for example). o VM Arguments: Values meant to change the behavior of the Java virtual machine (VM). For example, you may need to tell the VM whether to use a just-in-time (JIT) compiler, or you may need to specify the maximum heap size the VM should use. Refer to your VM's documentation for more information about the available VM arguments. o Working Directory: The working directory used for the launched process. To change from using the default working directory, select Other and specify the workspace or local directory to use for the working directory of the launched process. Click Apply or Close when you are done. Every time you launch this configuration, these execution arguments will be used.
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging
Re-launching a program
The workbench keeps a history of each launched and debugged program. To relaunch a program, do one of the following:
Select a previous launch from Run or Debug button pull-down menus. From the menu bar, select Run > Run History or Run > Debug History and select a previous launch from these sub-menus. In the Debug View, select a process that you want to relaunch, and select Relaunch from the process's pop-up menu.
Click the Run or Debug buttons (without using the button pull-down menu). Select Run > Run Last Launched (Ctrl+F11), or Run > Debug Last Launched (F11) from the workbench menu bar.
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging
The Monitors pane is located on the left-hand side of the view. This portion of the view contains a list of expressions, variables, and registers that you have added for monitoring. The Renderings pane is located on the right-hand side of the view (if the view is set to horizontal orientation). You use it to set the data format (or formats) that you want displayed for monitored memory.
When you monitor an address or expression from the Monitors pane, the Renderings pane becomes populated with a set of default renderings provided by your debugger. When you monitor an address or expression from the Renderings pane, the pane becomes populated with a list of renderings from which you can choose one to display. You can monitor multiple variables, expressions, and registers in the Memory view - and you can add multiple renderings to the Renderings pane. In the Monitors pane, each variable, expression, or register that you have added is listed. In the Renderings pane, only the memory rendering(s) for the currently-selected monitor in the Memory view is displayed (multiple renderings are separated by tabs or a split pane). You can set the two panes in the Memory view to display in a horizontal orientation (side-by-side) or in a vertical orientation (top-to-bottom). To set the layout of the view, click the Memory view down-arrow icon and select Layout from the menu. This will open a submenu, from which you can choose the orientation that you want to display.
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Inspecting memory in the Memory view
You can add a register, variable name, or expression (such as a raw address, for example, 0x00000234) to a memory monitor from the Memory view. To add a new memory monitor from the Memory view: Click the Memory view Add Memory Monitor push button ( ). This button is located in the Monitors pane. 2. In the Monitor Memory dialog box, enter the address or expression in the field (expressions must evaluate to an address). This entry does not need to be case-sensitive. Alternatively, if you have previously monitored the address or expression when debugging this application, choose it from the pull down list. Depending on the debug engine that the debugger user interface is connected to, examples of valid expressions include register names, variables, and HEX addresses.
1.
Note: When adding a register to a memory monitor, the Registers view is a convenient location to see the names of all registers in your application. You can make note of the name of a register from the view and then use it when adding a memory monitor.
3.
Click OK.
After adding the new memory monitor you can choose the memory format that you want to display in the Renderings pane. You can also add a new memory monitor from the Memory view Renderings pane: Click the Memory view Add Rendering(s) push button ( ). This button is located in the Renderings pane. 2. In the Add Memory Rendering dialog box, select an existing memory monitor from the pulldown list - or add a new memory monitor by clicking Add New. If you add a new memory monitor, you will be prompted via the Monitor Memory dialog box to enter an address or expression to monitor. Click OK to return to the Add Memory Rendering dialog box. 3. Do one of the following: o Select the memory rendering that you want to display for the memory monitor and click OK. o Click Cancel and then choose the memory rendering that you want to display right from the Renderings pane.
1.
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Inspecting memory in the Memory view
You can also split the Memory Renderings pane by selecting the Toggle Split Pane push button ( ). When the Renderings pane is split, you can view two renderings side-by-side. When you have multiple memory renderings for a memory monitor, you can set the renderings to be linked with one another. To do this, select the Link Memory Rendering Panes push button ( ). When renderings are linked, they are synchronized with each other (for example, if you change the column size in one rendering, the column size in the other rendering will also change - or if you scroll or move the cursor in one rendering, the other rendering will scroll or follow the same cursor movement). Linking memory renderings only applies to the current Memory view. If you have multiple Memory views open, they do not link to each other. To remove a rendering, select it in the Renderings pane and click Remove Rendering ( ). When you remove all memory renderings for a monitored expression, variable, or register, the Renderings pane will be populated with the memory rendering selection list. From this list, you can select the data format that you want to use for the memory rendering and then click Add Rendering(s).
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Inspecting memory in the Memory view
2.
3.
In the Monitors pane, select the memory monitor that contains the memory location that you want to view. Memory will appear in the Renderings pane, where you will perform all other steps. If you have added multiple renderings, select the tab that contains the rendering that you want to view. If desired, split the Renderings pane by selecting the Toggle Split Pane push button ( ). By default, the Memory view only displays one rendering pane. When you click Toggle Split Pane, a second rendering opens and displays as a split pane. If necessary, use the scroll bar in the rendering to view memory locations above or below the base address of the memory monitor being shown by the current rendering. Alternatively, you can right-click in the rendering and choose the Go to Address pop-up menu item or hit Ctrl+G. This will open a section at the bottom of the rendering, in which you can perform the following actions: o Select the Go to Address pull-down menu item and then enter an address that you want to jump to. The rendering will be positioned so that the address entered is visible and selected. o Select the Go to Offset pull-down menu item and then enter the offset. The rendering will be positioned so that the address of the expression (base address), plus the offset entered, is visible and selected. A negative value will position the rendering back from the base address. o Select the Jump Memory Units pull-down menu item. This function takes the currently-selected address and adds the number of memory units that you specify to it. The resulting address is selected. A negative value will position the rendering back from the current address. For all of these entries, you can input them as HEX by selecting the Input as Hex check box (if this check box is not selected, input will be decimal). Once you have made the entry in the field, hit Enter or click OK to go to the location in the rendering. To close this section, click Cancel or hit Ctrl+G.
Note: Input is also treated as HEX if it is prefixed with 0x. If you want, change the width of any column by clicking the left or right side of its header cell and dragging it to alter the width of the column - or right-click inside the rendering and select Resize to Fit from the pop-up menu so that all columns are re-sized so that all text within them can be viewed. Alternatively, you can right-click inside the rendering and select Format from the pop-up menu. This will open the Format dialog box. In this dialog box, you can set the number of units per row and the number of units per column. As you make these settings, a Preview window in the dialog box displays the rendering layout that you are setting. To save these settings as the default layout, click Save as Defaults. 5. You can also hide elements of the Memory view for easier viewing: o You can hide the Monitors pane by deselecting the Toggle Memory Monitors Pane toggle. o You can hide the Address column by right-clicking inside the rendering and selecting Hide Address Column. To restore a the address column when it is hidden, right-click inside the rendering and select Show Address Column from the pop-up menu.
4.
If you are in a memory rendering and move away from the address that you originally set to monitor, choosing the Reset to Base Address pop-up menu item will position the cursor back to the base address of the memory monitor. Alternatively, you can reset all renderings for a memory monitor by right-clicking the monitor and selecting Reset (or, you can select multiple monitors and choose this action). When you reset a monitor, by default, the visible renderings will be reset to the base address. To reset all renderings in the current Memory view to the base address, modify the Memory view preferences.
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Inspecting memory in the Memory view
Tip: If the rendering is currently in focus, you do not need to double-click the value that you want to change to be able to edit it. Rather, you can simply start typing the change and the editor will activate. 4. Enter a valid value for that memory location. 5. Press Enter to submit the change. The debugger checks for a valid value.
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Inspecting memory in the Memory view
Automatic radio button: Select this if you want the debugger to automatically preload a buffer of memory before and after the visible region in the Memory view. When you select this setting, you can easily scroll away from the visible region of memory with scroll and page up/down actions.
If the buffer size is large, the performance of refreshing the Memory view can be negatively impacted (the Memory view refreshes when there is a potential for memory change - so, for example, the Memory view refreshes when you step, suspend after running, change a
variable or register, or modify memory). This is because a request for more memory must be made from the debug engine for each refresh. On the other hand, if the buffer size is too small, the performance of scrolling can be negatively impacted. This is because a request for more memory must be made from the debug engine when the buffer is exhausted. Given this performance trade-off, you need to set this option to suit your needs.
Manual radio button: If you select this setting, then the number of lines per page that you specify will be loaded into the Renderings pane. When using this setting, you have more control in choosing exactly what you want to monitor, however, you will not be able to scroll outside the buffer defined by this page size setting. Instead, to view memory from the next page or previous page, you must right-click to use the Previous Page and Next Page actions from the pop-up menu.
If the buffer size is large, the performance of refreshing the Memory view can be negatively impacted (the Memory view refreshes when there is a potential for memory change - so, for example, the Memory view refreshes when you step, suspend after running, change a variable or register, or modify memory). This is because a request for more memory must be made from the debug engine for each refresh.
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Inspecting memory in the Memory view
----------------------------------------------------------------------------Java development user guide > Tasks > Running and Debugging > Inspecting memory in the Memory view
Select the memory monitor that you want to remove (by selecting it in the list in the Monitors pane). Click the Remove Memory Monitor push button ( ).
To remove multiple memory monitors, select them using the keyboard Ctrl or Shift keys, and then click Remove Memory Monitor. To remove all memory monitors, click Remove All.
Note: If you have added multiple renderings for a memory monitor, all renderings will be removed when you choose to remove the monitor.
Scrapbook
The Java development toolkit (JDT) contributes a scrapbook facility that can be used to experiment and evaluate Java code snippets before building a complete Java program. Snippets are edited and evaluated in the Scrapbook page editor, with resultant problems reported in the editor. From a Java scrapbook editor, you can select a code snippet, evaluate it, and display the result as a string. You can also show the object that results from evaluating a code snippet in the debuggers' Expressions View.
Creating a Java scrapbook page Displaying the result of evaluating an expression Inspecting the result of evaluating an expression
New Java Scrapbook Page wizard Java Scrapbook page Expressions view
----------------------------------------------------------------------------Java development user guide > Tasks > Using the Scrapbook
Create a file with a .jpage extension From the menu bar, select File > New > Other.... Then select Java > Java Run/Debug > Scrapbook Page. Then click Next.
In the Enter or select the folder field, type or click Browse to select the container for the new page. In the File name field, type a name for the new page. The .jpage extension will be added automatically if you do not type it yourself. Click Finish when you are done. The new scrapbook page opens in an editor.
----------------------------------------------------------------------------Java development user guide > Tasks > Using the Scrapbook
Scrapbook
Creating a Java scrapbook page Displaying the result of evaluating an expression Executing an expression Viewing runtime exceptions
----------------------------------------------------------------------------Java development user guide > Tasks > Using the Scrapbook
For example:
Type and highlight new java.util.Date() in the editor, and click Display. A result such as (java.util.Date) Tue Jun 12 14:03:17 CDT 2001 appears in the editor. As another example, type and highlight 3 + 4 in the editor, and press Display. The result (int) 7 is displayed in the editor.
Scrapbook
Executing an expression Inspecting the result of evaluating an expression Viewing runtime exceptions
----------------------------------------------------------------------------Java development user guide > Tasks > Using the Scrapbook
Executing an expression
Executing an expression evaluates an expression but does not display a result.
If you select the expression to execute and click the Execute button in the toolbar, no result is displayed, but the code is executed. For example, if you type and highlight System.out.println("Hello World"), and click the Execute button, Hello World appears in the Console view, but no result is displayed in the scrapbook editor or the Expressions view.
Java views
Displaying the result of evaluating an expression Inspecting the result of evaluating an expression Viewing runtime exceptions
----------------------------------------------------------------------------Java development user guide > Tasks > Using the Scrapbook
----------------------------------------------------------------------------Java development user guide > Tasks > Using the Scrapbook
----------------------------------------------------------------------------Java development user guide > Tasks > Using the Scrapbook > Scrapbook error reporting
----------------------------------------------------------------------------Java development user guide > Tasks > Using the Scrapbook > Scrapbook error reporting
Java editor
Displaying the result of evaluating an expression Inspecting the result of evaluating an expression Executing an expression
-----------------------------------------------------------------------------
Code Formatter
----------------------------------------------------------------------------Java development user guide > Tasks > Using the Formatter Application
Java source files and/or directories to format. Only files ending with .java will be formatted in the given directory. Description Use the formatting style from the specified properties file. Refer to Generating a config file for the formatter application for details. Display the help message. Only print error messages. Be verbose about the formatting job.
Code formatter
----------------------------------------------------------------------------Java development user guide > Tasks > Using the Formatter Application
Code formatter
Reference
Contents
Breakpoints Menus and Actions Preferences Property Pages Refactoring Search Toolbar Views Java Editor Wizards and Dialogs Frequently-Asked Questions: JDT Glossary Icons Available Quick Assists Available Quick Fixes List of JDT Key Bindings
-----------------------------------------------------------------------------
Breakpoints
A breakpoint suspends the execution of a program at the location where the breakpoint is set. Breakpoints can be enabled and disabled via the context menu in the Breakpoints View, or via the context menu in the Java Editor ruler.
An enabled breakpoint causes a thread to suspend whenever the breakpoint is encountered. Enabled breakpoints are drawn with a blue circle [ ] and have a checkmark overlay once successfully installed. A breakpoint can only be installed when the class the breakpoint is located in has been loaded by the VM. A disabled breakpoint will not cause threads to suspend. Disabled breakpoints are drawn with a white circle [ ].
Breakpoints are displayed in the vertical editor ruler and in the Breakpoints view.
Adding breakpoints Resuming the execution of suspended threads Running and debugging Suspending threads
Debug preferences Debug view Run menu actions Run and debug toolbar actions Breakpoints view
int age = 0; public Person(String name, int age) { this.name = name; this.age = age; //breakpoint here
} };
If we take the above example, place a breakpoint where indicated and go to the breakpoint properties we can add our condition. In this case we are limited only to the members of the class the breakpoint is contained in and those provided by Object. For example a valid condition could be:
age == 56
meaning the breakpoint would only suspend when age was equal to 56. Conditions can be added to breakpoints with the Breakpoints Properties... shown below.
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Enabled Option Hit Count Suspend Policy Method Entry Method Exit
Breakpoint Enabled
Select the Enabled option to enable or disable a breakpoint. This option can be changed with the Breakpoint Properties..., by right-clicking a breakpoint, or by selecting the breakpoint or its grouping in the Breakpoints View.
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Breakpoints
Catching exceptions Creating Exception Breakpoint Filters Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Add Java exception breakpoint Enabled Option Hit Count Suspend Policy
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Breakpoints
Setting method breakpoints Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Enabled Option Hit Count Suspend Policy Method Exit Breakpoint Conditions
Breakpoints
Setting method breakpoints Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Enabled Option Hit Count Suspend Policy Method Exit Breakpoint Conditions
Suspend Thread - suspends only the thread that encountered the breakpoint Suspend VM - suspends the entire VM when the breakpoint is encountered
This option can be changed with the Breakpoint Properties..., or by right-clicking a breakpoint.
You can also change the default setting for the suspend policy for all newly created breakpoints. To do this go to the Java >Debug preference page and change it there.
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
-----------------------------------------------------------------------------
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Opening the Breakpoint Properties Dialog Watchpoint Modification Context Action Enabled Option Hit Count Suspend Policy
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Opening the Breakpoint Properties Dialog Watchpoint Access Context Action Enabled Option
JDT Actions
JDT actions are available from
Frequently asked questions on JDT JDT glossary File menu actions Edit menu actions Source menu actions Refactor menu actions Navigate menu actions Search menu actions Project menu actions Run menu actions Java toolbar actions Run and debug toolbar actions Java editor actions
----------------------------------------------------------------------------Java development user guide > Reference > Menus and Actions
File actions
File menu commands: Name New Function Create a Java element or a new resource. Configure which elements are shown in the submenu in Window > Customize Perspective. In Keyboard Shortcut Alt + Shift + N
a Java perspective, by default action for creating a project, package, class, interface, enum, annotation, source folder, Java working set, JUnit test, file and folder are available. Open File Close Close All Save Save As Save All Revert Move Opens a file from the file system in an editor. Close the current editor. If the editor contains unsaved data, a save request dialog will be shown. Close all editors. If editors contains unsaved data, a save request dialog will be shown. Save the content of the current editor. Disabled if the editor does not contain unsaved changes. Save the content of the current editor under a new name. Save the content of all editors with unsaved changes. Disabled if no editor contains unsaved changes. Revert the content of the current editor back to the content of the saved file. Disabled if the editor does not contain unsaved changes. Move a resource. Disabled on Java Elements. To move Java elements use Refactor > Move (with updating all references to the file) or Edit > Cut / Paste (no updating of references). Renames a resource. Disabled on Java Elements. To rename Java elements use Refactor > Rename (with updating all references to the file). Refreshes the content of the selected element with the local file system. When launched from no specific selection, this command refreshes all projects. F5 Ctrl + Shift + S Ctrl + W Ctrl + Shift + W Ctrl + S
Rename
Refresh
Convert Line Convert the line delimiters of all the text files in the selection to the Delimiters To selected delimiter kind. Print Switch Workspace Restart Import Export Properties Prints the content of the current editor. Enabled when an editor has the focus. Switch to another workspace. Restarts the application. Opens the import wizard dialog. JDT does not contribute any import wizards. Opens the export wizard dialog. JDT contributes the JAR file export wizard and the Javadoc generation wizard. Opens the property pages of the select elements. Opened on Java projects the Java Build Path page and the Javadoc Location page are available. For JAR archives, configure the JAR's Source Attachment and Javadoc Location here. Exit Eclipse Alt + Enter Ctrl + P
Exit
New Java project wizard New Java package wizard New Java class wizard New Java enum wizard New Java interface wizard New Java annotation wizard JAR file exporter Javadoc generation Javadoc location properties Java build path properties Source attachment properties
----------------------------------------------------------------------------Java development user guide > Reference > Menus and Actions
Edit actions
Edit menu commands shown when a Java editor is visible: Name Undo Redo Cut Function Revert the last change in the editor Revert an undone change Copies the currently selected text or element to the clipboard and removes the element. On elements, the remove is not performed before the clipboard is pasted. Copies the currently selected text or elements to the clipboard Keyboard Shortcut Ctrl + Z Ctrl + Y Ctrl + X Ctrl + C
Copy
Copy Qualified Copies the fully qualified name of the currently selected element Name to the clipboard Paste Delete Select All Expand Selection To Paste the current content as text to the editor, or as a sibling or child element to the a currently selected element. Delete the current text or element selection. Select all the editor content.
Enclosing Element: Selects the enclosing expression, block, or method in the code. This action is aware of the Java syntax. It may not function properly when the code has syntax errors. (Arrow Up)
Next Element: Selects the current and next elements. (Arrow Right) Previous Element: Selects the current and previous elements. (Arrow Left) Restore Last Selection: Restores the previous selection after an invocation of Expand Selection To. (Arrow Down) Ctrl + F Ctrl + K
Open the Find / Replace dialog. Editor only. Finds the next occurrence of the currently selected text. Editor only.
Finds the previous occurrence of the currently selected text. Editor Ctrl + Shift + only. K Starts the incremental find mode. After invocation, enter the search text as instructed in the status bar. Editor only. Starts the incremental find mode. After invocation, enter the search text as instructed in the status bar. Editor only. Ctrl + J Ctrl + Shift + J
Add Bookmark Add a bookmark to the current text selection or selected element. Add Task Add a user defined task to the current text selection or selected element. Toggles the Insert Mode. When smart insert mode is disabled, Ctrl + Shift + typing aids like automatic indentation, closing of brackets etc. are Insert disabled. Shows the value of a hover that would appear at the current cursor location. The dialog shown is scrollable and does not shorten F2 descriptions. Opens a content assist dialog at the current cursor position. By default content assist supports five different categories of proposals. 1. Default - union all of proposals 2. Type Proposals (e.g. java.lang.String, List) 3. Other Java Proposals (e.g. method or field names) 4. Template Proposals (e.g. 'iterate over array' template) 5. Word Proposals (Proposes words which have been typed already) See the Java Editor preference page for configuring the behavior of code assist and the contents of the Default proposal category. See the Templates preference page for available templates. Word Completion Quick Fix Set Encoding Proposes word completions for the current string based on all words found in any open editor. Works in all text based editors. Alt + /
Content Assist
Ctrl + Space
Opens a dialog with possible solutions if the cursor is located near Ctrl + 1 a problem indication. Toggles the encoding of the currently shown text content.
Java editor Java editor preferences Java outline Views and editors
----------------------------------------------------------------------------Java development user guide > Reference > Menus and Actions
Source Actions
Source menu commands: Name Toggle Comment Add Block Comment Remove Block Comment Generate Element Comment Shift Right Function Comment or uncomment all lines containing the current selection. Keyboard Shortcut Ctrl + /
Adds a block comment around all lines containing the current Ctrl + Shift selection. +/ Removes a block comment from all lines containing the current selection. Ctrl + Shift +\
Adds a comment to the selected element. See the Code templates preference page to specify the format of the Alt + Shift + generated comments. Available on types, fields, constructors, J and methods. Increments the level of indentation of the currently select lines. Only activated when the selection covers multiple lines or a single whole line. Decrements the level of indentation of the currently select lines. Only activated when the selection covers multiple lines or a single whole line. Corrects the indentation of the lines denoted by the current text selection. Ctrl + I
Shift Left
Uses the code formatter to format the current text selection. Ctrl + Shift The formatting options are configured on the Code Formatter +F preference page. Uses the code formatter to format the Java element comprising the current text selection. The Format Element action works on method and type level. The formatting options are configured on the Code Formatter preference page.
Format Element
Add Import
Creates an import declaration for a type reference currently Ctrl + Shift selected. If the type reference if qualified, the qualification +M will be removed if possible. If the referenced type name can not be mapped uniquely to a type of the current project you will be prompted to specify the correct type. Add Import tries to follow the import order as specified in the Organize Import preference page Organizes the import declarations in the compilation unit currently open or selected. Unnecessary import declarations are removed, and required import declarations are ordered as specified in the Organize Imports preference page. Organize imports can be executed on incomplete source and will Ctrl + Shift prompt you when a referenced type name can not be mapped + O uniquely to a type in the current project. You can also organize multiple compilation units by invoking the action on a package or selecting a set of compilation units. Sorts the members of a type according to the sorting order specified in the Member Sort Order preference page Performs various changes in order to clean up your code according to the settings specified in the Clean Up preference page Opens the Override Method dialog that allows you to override or implement a method in the current type. Available on types or on a text selection inside a type. Opens the Generate Getters and Setters dialog that allows you to create Getters and Setters for fields in the current type. Available on fields and types or on a text selection inside a type. Opens the Generate Delegate Methods dialog that allows you to create method delegates for fields in the current type. Available on fields and types with fields. Opens the Generate HashCode and Equals dialog that allows you to start and control the generation of hashCode and equals methods in the current type. Opens the Generate toString() dialog that allows you to start and control the generation of a toString() method in the current type. Adds constructors which initialize fields for the currently selected types. Available on types, fields or on a text selection inside a type.
Organize Imports
Adds constructors as defined in the super class for the Add Constructor from currently selected types. Available on types or on a text Superclass selection inside a type. Surround the selected statements with a code template. Create your own templates on the Template preference page. Alt + Shift + Further, you can use Expand Selection to from the Edit menu Z to get a valid selection range.
Surround With
Opens the Externalize strings wizard. This wizards allows you to replace all strings in the code by statements accessing a property file. Searches for broken externalized strings in a selected property file, package, project or set of projects.
Externalizing strings
Java editor Java editor preferences Java outline Views and editors
Refactor Actions
Refactor menu commands: Name Rename Description Renames the selected element and (if enabled) corrects all references to the elements (also in other files). Available: Methods, method parameters, fields, local variables, types, type parameters, enum constants, compilation units, packages, source folders, projects and on a text selection resolving to one of these element types Shortcut: Options: Alt + Shift + R Renaming a type does allow to rename similarly named variables and methods. Enable 'Update similarly named variables and methods' in the Rename Type dialog. Select 'Configure...' to configure the strategy for matching type names. Renaming a package does allow to rename its subpackages. Enable 'Rename subpackages' in the Rename Package dialog. Enable 'Keep original method as delegate to changed method' to
keep the original method. Optionally you can deprecate the old method. Move Moves the selected elements and (if enabled) corrects all references to the elements (also in other files). Available: Instance method (which can be moved to a component), one or more static methods, static fields, types, compilation units, packages, source folders and projects and on a text selection resolving to one of these element types Shortcut: Options: Change Method Signature Alt + Shift + V You can use Drag & Drop in the Package Explorer to start this refactoring.
Changes parameter names, parameter types, parameter order and updates all references to the corresponding method. Additionally, parameters and thrown exceptions can be removed or added and method return type and method visibility can be changed. Available: Methods or on text selection resolving to a method Shortcut: Options: Alt + Shift + C Enable 'Keep original method as delegate to changed method' in the Change Method Signature dialog to keep the original method.
Extract Method
Creates a new method containing the statements or expression currently selected and replaces the selection with a reference to the new method. This feature is useful for cleaning up lengthy, cluttered, or overly-complicated methods. Available: You can use Expand Selection to from the Edit menu to get a valid selection range. This refactoring is also available as quick assist on statements and expressions selected in the editor. Shortcut: Alt + Shift + M
Creates a new variable assigned to the expression currently selected and replaces the selection with a reference to the new variable. Available: Text selections that resolve to local variables. You can use Expand Selection to from the Edit menu to get a valid selection range. This refactoring is also available as quick assist on expressions selected in the editor. Shortcut: Alt + Shift + L
Extract Constant
Creates a static final field from the selected expression and substitutes a field reference, and optionally rewrites other places where the same expression occurs. Available: Constant expressions or text selections which resolve to constant expressions This refactoring is also available as quick assist on expressions selected in the editor. Inline local variables, methods or constants. Available: Methods, static final fields and text selections that resolve to methods, static final fields or local variables This refactoring is also available as quick assist on local variables selected in the editor.
Inline
Shortcut: Convert Anonymous Class to Nested Convert Member Type to Top Level
Alt + Shift + I
Converts an anonymous inner class to a member class. Available: Anonymous inner classes Creates a new Java compilation unit for the selected member type, updating all references as needed. For non-static member types, a field is added to allow access to the former enclosing instance, if necessary. Available: Member types or text resolving to a member type. This refactoring is also available as quick assist on member classes selected in the editor. Turn a local variable into a field. If the variable is initialized on creation, then the operation moves the initialization to the new field's declaration or to the class's constructors. Available: Text selections that resolve to local variables. This refactoring is also available as quick assist on local variables selected in the editor. Extracts a common superclass from a set of sibling types. The selected sibling types become direct subclasses of the extracted superclass after applying the refactoring. Available: Types Options: Enable 'Use the extracted class where possible' to use the newly created class wherever possible. See Use Supertype Where Possible.
Extract Superclass
Extract Interface
Creates a new interface with a set of methods and makes the selected class implement the interface. Available: Types Options: Enable 'Use the extracted interface type where possible' to use the newly created interface wherever possible. See Use Supertype Where Possible.
Replaces occurrences of a type with one of its supertypes after identifying all places where this replacement is possible. Available: Types Moves a set of methods and fields from a class to its subclasses. Available: One or more methods and fields declared in the same type or on a text selection inside a field or method Moves a field or method to a superclass of its declaring class or (in the case of methods) declares the method as abstract in the superclass. Available: One or more methods, fields and member types declared in the same type or on a text selection inside a field, method or member type Replaces a set of fields with new container object. All references to the fields are updated to access the new container object. Available: The set of fields or a type containing fields Options: Enable 'Create Getter and Setters' to add accessor methods to the
Push Down
Pull Up
Extract Class
new type Introduce Replaces a set of parameters with a new class, and updates all callers of the Parameter Object method to pass an instance of the new class as the value to the introduce parameter. Available: Methods or on text selection resolving to a method Options: Introduce Indirection Enable 'Keep original method as delegate to changed method' in the Introduce Parameter Object dialog to keep the original method.
Creates a static indirection method delegating to the selected method. Available: Methods or on text selection resolving to a method Options: Enable 'Redirect all method invocations' to replace all calls to the original method by calls to the indirection method.
Introduce Factory Creates a new factory method, which will call a selected constructor and return the created object. All references to the constructor will be replaced by calls to the new factory method. Available: Constructor declarations Introduce Parameter Replaces an expression with a reference to a new method parameter, and updates all callers of the method to pass the expression as the value of that parameter. Available: Text selections that resolve to expressions
Encapsulate Field Replaces all references to a field with getter and setter methods. Available: Field or a text selection resolving to a field. This refactoring is also available as quick assist on field declarations and references selected in the editor. Generalize Declared Type Allows the user to choose a supertype of the reference's current type. If the reference can be safely changed to the new type, it is. Available: Type references and declarations of fields, local variables, and parameters with reference types Replaces raw type occurrences of generic types by parameterized types after identifying all places where this replacement is possible. Available: Projects, packages, and types Options: 'Assume clone() returns an instance of the receiver type'. Wellbehaved classes generally respect this rule, but if you know that your code violates it, uncheck the box. 'Leave unconstrained type arguments raw (rather than inferring <? >)'. If there are no constraints on the elements of e.g. ArrayList a, uncheck this box will cause Eclipse to still provide a wildcard parameter, replacing the reference with ArrayList<?>. Migrate JAR File Migrates a JAR File on the build path of a project in your workspace to a newer version, possibly using refactoring information stored in the new JAR File to avoid breaking changes. Available: JAR Files on build path Create Script Creates a script of the refactorings that have been applied in the workspace. Refactoring scripts can either be saved to a file or copied to the clipboard. See Apply Script.
Available: Always Apply Script Applies a refactoring script to projects in your workspace. Refactoring scripts can either be loaded from a file or from the clipboard. See Create Script. Available: Always Browses the workspace refactoring history and offers the option to delete refactorings from the refactoring history. Available: Always
History
Refactoring commands are also available from the context menus in many views and the Java editor.
Refactoring support
----------------------------------------------------------------------------Java development user guide > Reference > Menus and Actions
Navigate Actions
Navigate menu commands: Name Go Into Go To Function Sets the view input to the currently selected element. Supported by the Package Explorer view.
Keyboard Shortcut
Back: Sets the view input to the input back in history: Only enabled when a history exists (Go Into was used) Forward: Sets the view input to the input forward in history: Only enabled when a history exists (Go Into, Go To > Back were used) Up One Level: Sets the input of the current view to its input's parent element Type: Browse for a type and reveal it in the current view. Supported by the Package Explorer view Package: Browse for a package and reveal it in the current view. Supported by the Package Explorer view Resource: Browse for a resource and reveal it in the current view. F3
Open Declaration
selection and opens the file declaring the reference. Open Type Hierarchy Tries to resolve the element referenced at the current code selection and opens the element in the Type Hierarchy view. F4 Invoked on elements, opens the type hierarchy of the element. Supported in the Java editor and views showing Java elements. Ctrl + Alt + H
Open Call Hierarchy Tries to resolve the method referenced at the current code selection and opens the element in the Call Hierarchy view. Open Super Implementation Open an editor for the super implementation of the currently selected method or method surrounding the current cursor position. No editor is opened if no method is selected or the method has no super implementation. Opens the Javadoc documentation of the currently selected element or text selection. The location of the Javadoc of a JAR or a project is specified in the Javadoc location property page on projects or JARs. Note that this external Javadoc documentation may not be up to date with the Javadoc specified in the current code. You can create Javadoc documentation for source files in a Java project using the Javadoc export wizard. Brings up the Open Type dialog to open a type in the editor. The Open Type selection dialog shows all types existing in the workspace.
Shift + F2
Open Type
Ctrl + Shift +T
Brings up the Open Type dialog to open a type in the editor and Ctrl + Shift the Type Hierarchy view. The Open Type selection dialog +H shows all types that exist in the workspace. Opens the Open Resource dialog to open any resource in your workspace. Shows the currently selected element in the breadcrub bar of the Java editor. Choose to show the currently selected element in
Quick Outline Quick Type Hierarchy Next / Next Annotation / Next Thread Previous / Previous Annotation / Previous Thread Last Edit Location
Opens the lightweight outliner for the currently selected type. Opens the lightweight hierarchy viewer for the currently selected type. Selects the next annotation in the Java editor. Selects the next suspended thread in the Debug View. Selects the previous annotation in the java editor. Selects the previous suspended thread in the Debug View. Reveals the location where the last edit occurred.
Ctrl + .
Ctrl + , Ctrl + Q
Opens an a dialog which allows entering the line number to which the editor should jump to. Editor only. Reveals the previous editor location in the location history. Reveals the next editor location in the location history.
Opening an editor for a selected element Showing an element in the package explorer Opening a type in the package explorer Opening an editor on a type Opening a package
Package explorer view Type hierarchy view Javadoc location properties Javadoc export wizard
Search Actions
Search menu commands: Name Search... File... Java... Text Opens the search dialog Opens the search dialog on the File search page Opens the search dialog on the Java search page Searches for the selected text in the chosen scope:
Function
References
scope:
Finds all declarations of the selected Java element in the chosen scope: Declarations
Implementors
Finds all implementors of the selected interface in the chosen scope: (Workspace, Project or Working Set)
Read Access
Finds all read accesses to the selected field in the chosen scope:
Write Access
Finds all write accesses to the selected field in the chosen scope:
Occurrences in File
Identifier: Occurrences of all identifiers resolving to the selected element Implementing Methods: All methods implemented by the selected super-interface declaration Throwing Exceptions: All statements that possible throw Ctrl + Shift + U the selected declared exception Method Exits: All statements that can exit the method of the selected return type Break/Continue Target: The targets of the selected break and continue statement
Referring Tests
Finds all JUnit tests that refer to the currently selected type
Description Searches in the full workspace Searches in the project enclosing the selected element
types and members Searches in the type's hierarchy Searches in a working set
Scopes can be saved and names in the working set dialog. Existing instances of working sets are also available in the Search Scope submenu A Java search can also be conducted via the context menu of all Java views. The search context menu is also available in the Java editor. The search is only performed if the currently selected text can be resolved to a Java element. The type of the selected Java element defines which search context menus are available. The Java editor does not constrain the list of available Java searches based on the selection.
Java search
----------------------------------------------------------------------------Java development user guide > Reference > Menus and Actions
Project Actions
Project menu commands: Name Open Project Close Project Build All Function Shows a dialog that can be used to select a closed project and open it Closes the currently selected projects Builds all projects in the workspace. This is an incremental build, meaning that the builder analyzes the changes since the last time of Ctrl + B build and minimizes the number of changed files. Builds the currently selected project. This is an incremental build, meaning that the builder analyzes the changes since the last time of build and minimizes the number of changed files. Builds the projects contained in the currently selected working set. This is an incremental build, meaning that the builder analyzes the Keyboard Shortcut
Build Project
changes since the last time of build and minimizes the number of changed files. Clean... Build Automatically Generate Javadoc... Properties Shows a dialog where the projects to be cleaned can be selected. If selected, all modified files are automatically rebuilt if saved. This is an incremental build, meaning that the builder analyzes the changes since the last time of build and minimizes the number of changed files. Opens the Generate Javadoc wizard on the currently selected project. Opens the property pages on the currently selected project.
----------------------------------------------------------------------------Java development user guide > Reference > Menus and Actions
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. Presents a sub menu of registered run launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. F8 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume Run As
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. Presents a sub menu of the recent history of launch configurations launched in run mode F8 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume Run History
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. F8 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume
Run Last Allows you to quickly repeat the most recent launch in Ctrl + F11 Launched / Run run mode or quickly run the selected resource, if that mode is supported (based on your current launch
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. settings). Run To Line Executes the program to the currently selected line in Ctrl + R F8 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. the editor Step Into Steps into the current statement. F5 F8 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. Steps into the selected statement in the editor F8 Ctrl + F5 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume Step Into Selection
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. Steps over the highlighted statement. Execution will continue at the next line either in the same method or (if you are at the end of a method) it will continue in F8 F6 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume Step Over
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. the method from which the current method was called. The cursor jumps to the declaration of the method and F8 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. selects this line. F8 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. Steps out of the current method. This option stops execution after exiting the current method. F8 F7 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume Step Return
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. Suspends the selected thread of a target so that you can browse or modify code, inspect data, step, and so on. F8 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume Suspend
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. Terminates the selected debug target. Toggles the appropriate type of breakpoint based on F8 Ctrl + F2 Ctrl + Shift Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume Terminate Toggle
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. what is currently selected Toggles a line breakpoint on the current executable F8 +B Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume Breakpoint Toggle Line
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. line of code Toggles a method breakpoint on the currently selected F8 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume Breakpoint Toggle Method
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. method declaration Toggles a watchpoint on the currently selected field F8 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume Breakpoint Toggle
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. F8 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume Watchpoint Use Step Filters
Toggles step filters on/off. When on, all step functions Shift + F5
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. apply step filters. Watch Used to create a watch item. A watch item is an F8 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume
Run Menu Commands Command Name Add Java Exception Breakpoint Description Opens the Add Java Exception dialog to select the exception breakpoint type to create Shortcut
Add Class Load Opens the Select Type dialog to select the Java type to Breakpoint add a class load breakpoint to All Instances... Displays all of the instances of the selected type in the Ctrl + Shift current VM in a popup (only available with a Java 1.6 +N VM)
All References... Displays all of the references of the selected type in the current VM in a popup (only available with a Java 1.6 VM) Debug As Presents a sub menu of registered debug launch shortcuts. Launch shortcuts provide support for workbench or active editor selection sensitive launching. Presents a sub menu of the recent history of launch configurations launched in debug mode Allows you to quickly repeat the most recent launch in F11 debug mode or to debug the current selection, if that mode is supported (based on your current launch settings). Uses the Display view to show the result of evaluating Ctrl + Shift the selected expression in the context of a stack frame + D or variable in that thread. If the current active part is a Java Snippet Editor, the result is displayed there. Within the context of the Java snippet editor, this command allows you to evaluate an expression but does not display a result. Forces the current method to return with the specified value Uses the Expressions view to show the result of inspecting the selected expression or variable in the context of a stack frame or variable in that thread. This command opens the launch configuration dialog to manage debug mode launch configurations. Opens the launch configuration dialog to manage run mode launch configurations. Removes all of the breakpoints from the current workspace Resumes a suspended thread. expression in the Expressions view whose value is updated as you debug. F8 Ctrl + E
Execute
Open Debug Dialog... Open Run Dialog... Remove All Breakpoints Resume
Running and Debugging Connecting to a remote VM with the Remote Java application launch configuration Adding Line breakpoints Setting method breakpoints Catching exceptions
Interface See new Java interface wizard Create a Java annotation This command helps you create a new Java annotation. See new Java annotation wizard Create a JUnit test case Open Type This command helps you create a new JUni test case. This command allows you to browse the workspace for a type to open in the defined default Java editor. You can optionally choose to display the type simultaneously in the Hierarchy view. See Open Type dialog.
New Java project wizard New Java package wizard New Java class wizard New Java enum wizard New Java interface wizard New Java annotation wizard New Java scrapbook page wizard Views and editors
Run and Debug toolbar actions Toolbar Button Command Debug Description This command re-launches the most recently launched application under debugger control, or launches the selected resource or active editor depending on the launch operation preference settings found on the Run/Debug > Launching preference page
Running and Debugging Connecting to a remote VM with the Remote Java application launch configuration Line breakpoints Setting method breakpoints Catching exceptions
Java editor
Toolbar actions
Toolbar Button Command Toggle Java Editor Breadcrumb Toggle Mark Occurrences Toggle Block Selection Mode Show Whitespace Characters Description This button enables the Java editor breadcrumb. The enablement is remembered for each perspective separately. Turns mark occurrences on and off in the Java editor. This button enables block (aka column) selection mode in the editor. This button enables the display of whitespace characters in an editor.
Toolbar Button
Description This button enabled display of a segmented view of the source of a compilation unit. This button is only shown if you customize your perspective to show the Editor Presentation actions. For example, if a method is selected in the Outline view, the Show Source Of Selected Element Only option causes only that method to be displayed in the editor, as opposed to the entire class. Off: The entire compilation unit is displayed in the editor, with the selected Java element highlighted in the marker bar with a range indicator. On: Only the selected Java element is displayed in the editor, which is linked to the selection in the Outline or Hierarchy view.
Go to Next Problem This command navigates to the next problem marker in the active editor. Go to Previous Problem This command navigates to the previous problem marker in the active editor.
Description Deletes from the cursor position to the beginning of the line. Deletes from the cursor position to the end of the line. Sets a mark at the current cursor position. Swaps the cursor and mark position if any.
Java editor
Java outline Java editor preferences JDT actions Views and editors
Preferences
Contents
Java Run/Debug
Java Preferences
The following Java preferences can be set on the
Appearance Build Path Code Style Compiler Debug Editor Installed JREs JUnit Properties File Editor Option Description Go into the selected element When you double click a container, a Go Into command is executed. See Go Into from the Navigate menu. Expand the selected element When you double click a container, it is expanded and its children are revealed. Default Expand the selected element
Open a new Type Hierarchy Perspective Show the Type Opens a new Type Hierarchy perspective Hierarchy View in the whenever a Type Hierarchy view is opened. current perspective Show the Type Hierarchy View in the current perspective The Type Hierarchy view is displayed in the current perspective. Note: On the Workbench preferences page, you can choose whether new perspectives open in a new window, in the current window, or as a replacement for the current perspective.
Description Save all modified resources automatically prior to Off refactoring If this option is turned off, refactorings may prompt to save modified files if required. If it is turned on, all modified files are saved without prompting prior to opening a refactoring wizard. Rename in editor without dialog If this option is turned on, then the rename refactoring will not show a dialog if invoked inside a Java editor. Instead the new name for the element to rename can be typed into the editor right away. On
Default
Search
Use reduced search menu If this option is turned on, the search context menus show only the most frequently used search actions.
On
Java dialogs
Clear all 'do not show again' settings and show all Button hidden dialogs again If pressed, all 'do not show' settings are cleared.
Java views
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java
The options are: Option Show method return types Description If enabled, methods displayed in views show the return type. Default Off
Option Show method type parameters Show categories Show members in Package Explorer Fold empty packages in hierarchical layout Compress package name segments Stack views vertically in the Java Browsing perspective
Description If enabled, methods displayed in views show their type parameters. If enabled, method, field and type labels contain the categories specified in their Javadoc comment. If enabled, Java elements below the level of Java files and Class files are displayed as well. If enabled, empty packages which do not contain resources or other child elements are folded. If enabled, package names, except for the final segment, are compressed according to the compression pattern. If enabled, views in Java Browsing perspective will be stacked vertically, rather than horizontally.
Java views
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Appearance
Types, Static Fields, Static Initializers, Move members of Static Methods, Fields, Initializers, selected category closer to Constructors, Methods the beginning of a type.
Option
Up Move members of selected visibility closer to the beginning of a category. Down Move members of selected visibility closer to the end of a category.
Java views
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Appearance
Quick fix
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java
The options are: Option Source and output folder Description Project Use the project root folder as the folder where Java source files and the generated class files are stored by default. Folders Specify separate source and output folders to store the Java source files separated from the generated class files. Select what kind of JRE library should be used for newly created Java projects. Default Folders Source Folder: src Output Folder: bin JRE container
Classpath variables
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Build Path
Configurable 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 and the build path can be shared in a team. The value of such variables is configured on the Java > Build Path > Classpath Variables preference page.
Description Adds a new variable entry. In the resulting dialog, specify a name and path for the new variable. You can click the File or Folder buttons to browse for a path. Allows you to edit the selected variable entry. In the resulting dialog, edit the name and/or path for the variable. You can click the File or Folder buttons to browse for a path. Removes the selected variable entry.
Remove
These variables are deprecated and should not be used anymore. Instead use a JRE System Library.
Classpath variables
Installed JREs
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Build Path
Option New... Edit... Add JARs... Remove.. Up Down Import... Export... Creates a new user library
Description
Edits the currently selected library, JAR or JAR attribute Adds one or more JARs to the currently selected user library Removes the currently selected user library or JAR Moves the currently selected JAR up in the list of JARs of a user library. The order can be important if more than one JAR contain a type with the same qualified name. Moves the currently selected JAR down in the list of JARs of a user library. The order can be important if more than one JAR contain a type with the same qualified name. Adds new libraries from an import file Exports libraries to an import file
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java
Naming Conventions
The list defines the naming conventions for fields (static and non-static), parameters and local variables. For each variable type it is possible to configure a list of prefix or suffix or both. Naming conventions are used by all actions and 'Quick Fix' proposals that create fields, parameters and local variables, in particular the Source actions. Action Edit... Description Opens a dialog to edit the list of prefix and suffixes for the currently selected variable type
Code Conventions
The following settings specify how newly generated code should look like. The names of getter methods can be specified as well as the format of field accesses, method comments, annotations and exception variables. Action Description Default Off
Qualify all generated If selected, field accesses are always prefixed with 'this', field accesses with regardless whether the name of the field is unique in the 'this.' scope of the field access or not. Use 'is' prefix for getters that return boolean Add '@Override' annotation for overriding methods If selected, the names of getter methods of boolean type are prefixed with 'is' rather than 'get'. If selected, methods which override an already implemented method are annotated with an '@Override' annotation. See the Compiler preference page for settings related to annotations.
On
On
Exception variable Specify the name of the exception variable declared in name in catch blocks catch blocks.
Source actions Java editor Java editor preferences Java compiler preferences Code templates preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Code Style
Clean Up Preferences
The Java > Code Style > Clean Up preference page lets you manage your code clean up profiles for the Java code clean up. Action Active profile Edit... Remove New... Description Selects the profile active for the workspace or current project. Shows a dialog which displays the settings stored in the active profile. Only user-defined profiles can be modified. Removes the selected profile. This action is only available on userdefined profiles. Shows the dialog to create a new profile. The dialog requires you to enter a name for the new profile. Additionally, you may select a built-in or user-defined existing profile to base your new profile on.
Description Imports profiles from the file system. Displays a summary of the enabled options of the active profile
Disable Show profile selection dialog for the 'Source > Clean Up' action to apply the active profile when you invoke Source > Clean Up without being disturbed by a dialog.
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Code Style
Off
Comment Templates
Comment templates can contain the variable ${tags} that will be substituted by the standard Javadoc tags (@param, @return..) for the commented element. The 'Overriding method' comment can additionally contain the template ${see_to_overridden} Template Name Files Specifies Header comment for new files.
Template Name
Specifies
Note that this template can be referenced in the 'New Java File' template with ${filecomment}. Types The comment for new types. Note that this template can be referenced in the 'New Java File' template with ${typecomment}. Fields Constructors Methods Overriding methods The comment for new fields. The comment for new constructors. The comment for new methods that do not override an method in a base class and that do not delegate to any other method. The comment for new methods that override an method in a base class. By default the comment is defined as a non-Javadoc comment (Javadoc will replace this comment with the comment of the overridden method). You can change this to a real Javadoc comment if you want Delegating methods The comment for new methods which delegate to existing methods. Such methods can be created with the Source > Generate Delegate Methods... action. Getters Setters The comment for getter methods. The comment for setter methods.
Code Templates
Template Name New Java files Description Used by the New Type wizards when a new Java file is created. The template can specify where comments are added. Note that the template can contain the variable ${typecomment} and $ {filecomment} that will be substituted by the evaluation of the Types respectively Files comment template. Class body Interface body Enum body Annotation body Method body Used by the New Class wizards when a new Java class is created. Used by the New Interface wizards when a new Java interface is created. Used by the New Enum wizards when a new Java enum is created. Used by the New Annotation wizards when a new Java annotation is created. The 'Method body' templates are used when new method with a body is created that still needs some code to complete its functionality. It contains the variable ${body_statement} that resolves to a return
Template Name
Constructor body
The 'Constructor body' templates are used when new method or constructor with body is created. It contains the variable ${body_statement} that resolves a super call.
Getter body
The 'Getter body' templates are used when new getter method is created. It contains the variable ${body_statement} that resolves to the appropriate return statement.
Setter body
The 'Setter body' templates are used when new setter method is created. It contains the variable ${body_statement} that resolves to the appropriate assignment statement.
The 'Catch block body' template is used when a catch block body is created. It can use the variables ${exception_type} and ${exception_var}.
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Code Style
The Java > Code Style > Formatter preference page lets you manage your code formatter profiles for the Java code formatter. Action Active profile Edit... Remove New... Description Selects the profile active for the workspace or current project. Shows a dialog which displays the settings stored in the active profile. Only user-defined profiles can be modified. Removes the selected profile. This action is only available on userdefined profiles. Shows the dialog to create a new profile. The dialog requires you to enter a name for the new profile. Additionally, you may select a built-in or user-defined existing profile to base your new profile on. Imports profiles from the file system. Displays a sample how the active profile formats a Java code snippet
Import... Details
To change your formatter options you can either select one of the built-in profiles or create a new profile. To create a new profile select New.... You can then edit the new profile by selecting Edit.... If your project is shared, e.g. through CVS, and uses a formatter profile which is not managed by yourself (you have not created the profile) then the profile will be marked as Unmanaged Profile. You are not allowed to change such a profile, only the creator (manager) of the profile can change it.
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Code Style
Option Edit... Remove Up Down Import... Export... Number of imports needed for .*
Description
Default
Edits the currently selected entry in the import order list. In the n/a resulting dialog, type a package name or package name prefix. Removes the currently selected entry from the import order list. n/a
Moves the selected package name prefix up in the import order n/a list. Moves the selected package name prefix down in the import order list. Loads a list of package name prefixes from a file. Saves the list of package name prefixes to a file. The number of import statements that are allowed for types in the same package before <package>.* is used. n/a n/a n/a 99 99 On
Number of static imports The number of static import statements that are allowed for needed for .* static members of the same type before type is used. Do not create imports for If enabled, types starting with a lowercase letter are not types starting with a imported. lower case letter
Source actions
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java
JDK Compliance
Option Compiler compliance Description Specifies the compiler compliance level. Default 1.4
level Use default compliance settings Generated class files compatibility Source compatibility Disallow identifiers called 'assert' Disallow identifiers called 'enum' If enabled, the default compliance settings for the compiler compliance level are applied. Specifies the generated class file compatibility. Specifies the compatibility of the accepted source code. When enabled, the compiler will issue an error or a warning whenever 'assert' is used as an identifier (reserved keyword in J2SE 1.4). When enabled, the compiler will issue an error or a warning whenever 'enum' is used as an identifier (reserved keyword in J2SE 1.5). On 1.2 1.3 Warning
Warning
Classfile generation
Add variable attributes to generated class files Add line number attributes to generated class files If enabled, variable attributes are added to the class file. This will enable local variable names to be displayed in the debugger (in places where variables are definitely assigned) The resulting .class file is then bigger. If enabled, line number information is added to the class file. This will enable source code highlighting in the debugger. On
On
Add source file name If enabled, the source file name is added to the class file. This will to generated class enable the debugger to present the corresponding source code. file Preserve unused local variables Inline finally blocks
On
If enabled, unused local variables (i.e. never read) are not stripped from On the class file. If stripped this potentially alters debugging. If enabled, finally blocks are inlined in the generated class files. This positively affects performance, but may result in larger class files. Off
Java builder
Classpath variables preferences Java build path properties Building preference page Errors/Warnings preference page Javadoc preference page Task tags preference page
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Compiler
General
Option Maximum number of reported problems per compilation unit Enable use of exclusion patterns in source folders Enable use of multiple output locations for source folders Description Specifies how many problems should be reported for a compilation unit. When disabled, no entry on a project classpath can be associated with an exclusion pattern. When disabled, no entry on a project classpath can be associated with a specific output location, preventing thus usage of multiple output locations. Default 100
On On
Indicate the severity of the problem reported when an entry on the Error classpath does not exist, is not legitimate or is not visible (e.g. a reference project is closed). Indicate the severity of the problem reported when a project is involved in a cycle. Indicated the severity of the problem reported when a project requires incompatible binaries. Error Ignore
Output folder
Duplicated resources Indicate the severity of the problem reported when more than one occurrence of a resource is to be copied into the output location. Indicate whether the Java Builder is allowed to clean the output folders when performing full build operations. Indicate whether class files which have been modified by others should be rebuilded to undo the modification. Warning
Scrub output folders when cleaning projects Rebuild class files modified by others Filtered resources
On Off
A comma separated list of file patterns which are not copied to Empty the output folder.
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Compiler
Code style
Option Non-static access to a static member Description Default
When enabled, the compiler will issue an error or a warning Warning whenever a static field or method is accessed with an expression receiver. A reference to a static member should be qualified with a type name. When enabled, the compiler will issue an error or a warning whenever a static field or method is indirectly accessed. A static field of an interface should be qualified with the declaring type name. When enabled, the compiler will issue an error or a warning whenever it encounters a field access which is not qualified (e.g. misses a 'this'). When enabled, the compiler will issue an error or a warning whenever it encounters an empty block statement with no explaining comment. Ignore
Unqualified access to instance field Undocumented empty block Access to a nonaccessible member of an enclosing type Method with a constructor name
Ignore
Ignore
When enabled, the compiler will issue an error or a warning Ignore whenever it emulates access to a non-accessible member of an enclosing type. Such accesses can have performance implications. Naming a method with a constructor name is generally considered poor style programming. When this option is enabled, the compiler will signal such scenario either as an error or a warning. Warning
Parameter assignment
Assigning a value to a parameter is generally considered poor Ignore style programming. When this option is enabled, the compiler will signal such scenario either as an error or a warning. When enabled, the compiler will issue an error or a warning for non externalized String literal (i.e. non tagged with // $NON-NLS-<n>$) or for non externalized String tags which do not belong to a String. Ignore
Non-externalized strings
Serializable class without serialVersionUID Assignment has no effect (e.g. 'x = x') Possible accidental boolean assignment (e.g. 'if (a = b)') 'finally' does not complete normally Empty statement
When enabled, the compiler will issue an error or a warning whenever a type implementing 'java.io.Serializable' does not contain a serialVersionUID field. When enabled, the compiler will issue an error or a warning whenever an assignment has no effect (e.g. 'x = x'). When enabled, the compiler will issue an error or a warning whenever it encounters a possible accidental boolean assignment (e.g. 'if (a = b)'). When enabled, the compiler will issue an error or a warning whenever a 'finally' statement does not complete normally (e.g. contains a return statement). When enabled, the compiler will issue an error or a warning whenever it encounters an empty statement (e.g. a superfluous semicolon). When enabled, the compiler will issue an error or a warning whenever a char[] expression is used in String concatenations,
"hello" + new char[]{'w','o','r','l','d'}
Warning
Warning Ignore
Warning
Ignore
Warning
Locally to a try statement, some catch blocks may hide others , e.g.
try { throw new java.io.CharConversionException(); } catch (java.io.CharConversionException e) { } catch (java.io.IOException e) {}.
Warning
When enabled, the compiler will issue an error or a warning for hidden catch blocks corresponding to checked exceptions. Inexact type match for vararg arguments When enabled, the compiler will issue an error or a warning whenever it encounters an inexact type match for vararg arguments. Warning
Boxing and unboxing When enabled, the compiler will issue an error or a warning conversions whenever it encounters a boxing or unboxing conversion. Autoboxing may affects performance negatively. Enum type constant not covered on 'switch' 'switch' case fallthrough Null pointer access
Ignore
When enabled, the compiler will issue an error or a warning Ignore whenever it encounters a switch statement which does not contain case statements for every enum constant of the referenced enum. When enabled, the compiler will issue an error or a warning whenever it encounters a switch case without a 'break' statement. Empty switch cases are allowed. When enabled, the compiler will issue an error or a warning when it encounters that a local variable which is certainly null is dereferenced. Note that the analysis can not find all null pointer accesses, see Potential null pointer access. When enabled, the compiler will issue an error or a warning when it encounters that a local variable which may be null is dereferenced. Note that the analysis is fairly conservative, it only considers cases where there is something suspicious. Ignore
Warning
Ignore
Comparing identical
When enabled, the compiler will issue an error or a warning if a comparisonis involving identical operands (e.g 'x == x')..
Warning
Local variable When enabled, the compiler will issue an error or a warning if Ignore declaration hides another a local variable declaration hides another field or variable. field or variable Include constructor or setter method parameters Type parameter hides another type Method does not override package visible method Interface method conflicts with protected 'Object' method When enabled, the compiler additionally will issue an error or a warning if a constructor or setter method parameter hides another field or variable. Off
When enabled, the compiler will issue an error or a warning if Warning i.e. a type parameter of an inner class hides an outer type. A package default method is not visible in a different package, Warning and thus cannot be overridden. When this option is enabled, the compiler will signal such scenario either as an error or a warning. When enabled, the compiler will issue an error or a warning whenever an interface defines a method incompatible with a non-inherited Object method. Until this conflict is resolved, such an interface cannot be implemented, e.g.
interface I { int clone(); }
Warning
Signal overriding or When enabled, the compiler will signal overriding or implementing deprecated implementing a deprecated method The severity of the method problem is controlled with option "Deprecated API". Forbidden reference (access rules) When enabled, the compiler will signal a forbidden reference specified in the access rules.
Error Warning
Discouraged reference (access When enabled, the compiler will signal a discouraged rules) reference specified in the access rules.
Unnecessary code
Local variable is never read When enabled, the compiler will issue an error or a warning whenever a local variable is declared but never Warning
used within its scope. Parameter is never read When enabled, the compiler will issue an error or a Ignore warning whenever a parameter is declared but never used within its scope. When enabled, the compiler will not issue an error or a On warning whenever a parameter is declared but never used within its scope in a method that overrides or implements another method. When enabled, the compiler will not issue an error or a warning whenever an unread parameter is documented with an '@param' tag. When enabled, the compiler will issue an error or a warning for unused import reference. When enabled, the compiler will issue an error or a warning whenever a local or private member is declared but never used within the same unit. When enabled, the compiler will issue an error or a warning whenever a local variable which can not be null is tested for null. When enabled, the compiler will issue an error or a warning whenever it encounters an unnecessary else statement (e.g. if (condition) return; else doSomething();). When enabled, the compiler will issue an error or a warning whenever it encounters an unnecessary cast or 'instanceof' operation (e.g. if (object instanceof Object) return;). When enabled, the compiler will issue an error or a warning whenever it encounters an unnecessary declaration of a thrown exception. When enabled, the compiler will not issue an error or a warning whenever it encounters an unnecessary declaration of a thrown exception in a method that overrides or implements another method. When enabled, the compiler will not issue an error or a warning whenever an an unnecessary declaration of a thrown exception is documented with an '@throws' or '@exception' tag. When enabled, the compiler will not issue an error or a warning whenever it encounters an unnecessary declaration of 'Exception' and 'Throwable' exception When enabled, the compiler will issue an error or a warning whenever it encounters an unused 'break' or 'continue' label. When enabled, the compiler will issue an error or a warning whenever it encounters a type which explicitly implements an interface that is already implemented by On
Ignore parameters documented with '@param' tag Unused import Unused local or private members Redundant null check
Warning Warning
Ignore
Ignore
Ignore
Ignore
On
Ignore exceptions documented with '@throws' or '@exception' tags Ignore 'Exception' and 'Throwable' Unused 'break' or 'continue' label Redundant super interface
On
On
Warning
Ignore
Generic types
Unchecked generic type operation Usage of a raw type When enabled, the compiler will issue an error or a warning Warning whenever it encounters an unchecked generic type operation. When enabled, the compiler will issue an error or a warning Warning whenever it encounters a usage of a raw type (i.e. List instead of List<String>). When enabled, the compiler will issue an error or a warning Warning whenever it encounters a type bound involving a final type.
Annotations
Missing '@Override' annotation When enabled, the compiler will issue an error or a warning whenever it encounters a method overriding another implemented method, and the '@Override' annotation is missing. When enabled, the compiler will issue an error or a warning whenever it encounters a deprecated type without additional '@Deprecated' annotation. When enabled, the compiler will issue an error or a warning whenever it encounters a type implementing an annotation. Although possible, this is considered bad practice. When enabled, the compiler will issue an error or a warning whenever it encounters an unhandled token in a '@SuppressWarnings' annotation. When enabled, the compiler will issue an error or a warning whenever it encounters an unused token in a '@SuppressWarnings' annotation. When enabled, the compiler will process '@SuppressWarnings' annotations. Ignore
Missing '@Deprecated' annotation Annotation is used as super interface Unhandled token in '@SuppressWarnings' Unused '@SuppressWarnings' token Enable '@SuppressWarnings' annotations
Ignore
Warning
Warning
Warning
On
When Treat errors like fatal compile errors is enabled, all generated errors, fatal or configurable, lead to non-executable code. If disabled, then your code can be executed as long as it has no fatal error (i.e. syntax error).
-----------------------------------------------------------------------------
Java development user guide > Reference > Preferences > Java > Compiler
Description The builder detects problems in Javadoc comments if this option is enabled. For search and refactoring to work on Javadoc comments it is also required to enable this option. When enabled, the compiler will issue an error or warning whenever it encounters a malformed Javadoc comment. The compiler does only check members with the specified or a broader visibility.
Default On
Ignore
Public Off
Validate tag arguments When enabled, the compiler will issue an error or (@param, @throws, warning whenever it encounters an error in a Javadoc @exception, @see, @link) comment tag argument for @param, @throws, @exception, @see or @link. Report non visible references Report deprecated references Missing tag descriptions When enabled, the compiler will issue an error or warning whenever it encounters a reference to a non visible element. When enabled, the compiler will issue an error or warning whenever it encounters a reference to a deprecated element.
Off
Off
Choose between 'Validate all standard tags', 'Validate 'Validate @return tags' and 'Ignore'. When enabled, the compiler @return will issue an error or warning whenever it encounters a tags' missing tag description When enabled, the compiler will issue an error or warning whenever it encounters a missing Javadoc tag (i.e. missing @param tag for a parameter). The compiler does only check members with the specified or a broader visibility. When enabled, also overriding and implementing methods are checked for missing Javadoc tags. When enabled, the compiler will issue an error or warning whenever it encounters a missing Javadoc comment for a Java member. The compiler does only check members with the specified or a broader visibility. When enabled, also overriding and implementing methods are checked for missing Javadoc comments. Ignore
Only consider members as visible as Check overriding and implementing methods Missing Javadoc comments
Public Off
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Compiler
Remove Removes the selected task tag. Edit... Default Allows you to edit the selected task tag. In the resulting dialog, edit the name and/or priority for the task tag. Sets the currently selected task tag as the default task tag. The default task tag is the one that is used in the code templates as specified on the Code Templates preference page. The default task tag is displayed in bold font.
Case sensitivity of the task tags can be specified at the bottom of the preference page using the option Case sensitive task tag names.
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java
Description
Default
For example if you try to call a method on a null object and a NullPointerException is thrown, with this option on your prgram will suspend at the location the exception was thrown Suspend execution on compilation errors Suspend on breakpoints during evaluations Open popup when suspended on exception Default suspend policy for new breakpoints Show error when hot code replace fails Show error when hot code replace is not supported Show error when obsolete methods remain after hot code replace Replace class files containing compilation errors Debugger timeout This option controls if a program will suspend when a compilation error is encountered This options controls if breakpoints will suspend during an evaluation of code containing a breakpoint. For more information about evaluations go here This option controls if a popup window will be displayed when execution of a program stops on an exception. The exception the program suspended on is made available for inspection in the popup This option allows the default suspend policy to be set for new breakpoints. The suspend policy is used by breakpoints to tell the VM what to suspend, in this case either the thread the breakpoint is active in or the entire running VM This option controls if the user will be presented with an error dialog when a hot code replace fails This option controls if the user will be presented with an error dialog when hot code replace is not supported, and the user has made and saved changes to currently running code This option controls if the user will be presented with an error dialog when a hot code replace completed, but there were obsolete methods left over This option controls is class files containing compilation errors will be replaced This option describes the length of time (in milliseconds) the debugger will wait trying to communicate with a running VM before giving up and disconnecting This option describes the length of time (in milliseconds) that a launch will wait to complete the launching process before giving up and terminating. This option has no bearing on the length of time a program will run, only how long the process of trying to run a program will wait This option controls if the user will be notified if they try to set a line breakpoint on a line that has invalid line information On On
Off
Suspend Thread
On On
On
On
3000
Launch timeout
20000
Warn when unable to install breakpoint due to missing line number attributes
On
Detail Formatters Preferences Heap Walking Preferences Installed JREs Preferences Logical Structures Preferences Primitive Display Preferences Run/Debug Preferences Step Filtering Preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Debug
Show variables details This option controls where you want to see the detial formatter appear, you have one of three choices:
As a label for variables with detail formatters - will appear as the primary display label only for associated variables the have detial formatters As a label for all variables - will appear for all associated
Option
Default
In detail pane only - will only appear in variables view detials panes and nowhere else
Heap Walking Preferences Installed JREs Preferences Java Debug Preferences Logical Structures Preferences Primitive Display Preferences Run/Debug Preferences Step Filtering Preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Debug
100
Detail Formatters Preferences Installed JREs Preferences Java Debug Preferences Logical Structures Preferences Primitive Display Preferences Run/Debug Preferences Step Filtering Preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Debug
Detail Formatters Preferences Heap Walking Preferences Installed JREs Preferences Java Debug Preferences Primitive Display Preferences Run/Debug Preferences Step Filtering Preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Debug
This option controls whether hexadecimal values will be Off displayed for the primitive types byte, short, char, int and long This option controls whether ASCII char values will be displayed for the primitive types byte, short, int and long Off Off
Display unsigned values (byte) This option controls whether unsigned values will be displayed for bytes
Detail Formatters Preferences Heap Walking Preferences Installed JREs Preferences Java Debug Preferences Logical Structures Preferences Run/Debug Preferences Step Filtering Preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Debug
This option controls is step filtering should be enabled or not. See also the On step filtering command in the Debug View This is a listing of all of the defined step filters (the listing itself) and whether the step filters are in use or not (the checked state of step filter) Used to add a new step filter that is based on a regular expression Used to add a new Java class to the listing of step filters
Add Packages Used to add new Java packages to the listing of step filters button Remove button Select All button Deselect All button Filter synthetic methods Filter static initializers Filter constructors Step through Used to remove the selected step filter(s) Used to set all defined step filters as enabled (or checked) Used to set all defined step filters as disabled (or unchecked) This option controls if synthetic method should always be filtered or not while stepping. This option requires that the VM used support synthetic methods This option controls if static initializers should always be filtered or not while stepping This option controls if constructors should always be filtered or not while stepping Off
Off Off
This option controls step filters to always return from a filtered location or On
Option filters
Description step through to a non-filtered location. For example, if java.util is a filtered location, stepping into code in HashMap could result in a call-back to your application code to check the equality of an object. If you choose to Step through filters a step into would end up in your application code. However, when the Step through filters option is disabled, a step into HashMap would behave like a step over.
Default
Detail Formatters Preferences Heap Walking Preferences Installed JREs Preferences Java Debug Preferences Logical Structures Preferences Primitive Display Preferences Run/Debug Preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java
Content Assist o Advanced o Favorites Folding Hovers Mark Occurrences Save Actions Syntax Coloring Templates Typing
Note that some options that are generally applicable to text editors can be configured on the text editor preference page. Option Smart caret positioning in Java names (overrides platform behavior) Report problems as you type Description If enabled, there are additional word boundaries inside | Camel|Case| Java names. If enabled, the editor marks errors and warnings as you type, even if you do not save the editor contents. The problems are updated after a short delay. If enabled, whenever the cursor is next to a parenthesis, bracket or curly braces, its opening or closing counter part is highlighted. The color of the bracket highlight is specified with Appearance color options. Light bulb for quick assists If enabled, a shows up in the vertical ruler whenever a quick assist is available. See the quick assist section for a list of the available assists. If enabled, the Java editor will only show the selected Java element which is currently selected (i.e. in the Outline View or the Package Explorer). Off Default On
On
On
Off
The colors of various Java editor appearance features are default specified here. colors Matching brackets highlight The color of brackets highlight. Parameter hints background The background color of the parameter hint window Parameter hints foreground The foreground color of the parameter hint window Completion overwrite background The background color of the completion overwrite window Completion overwrite foreground The foreground color of the completion overwrite window Source hover background The background color for the source hover. The source hover shows the source code of the element under the mouse pointer.
Java editor
Java editor Code formatter preferences Java outline Java content assist Quick Fix Quick Assist
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Editor
On
On
Insert parameter names If selected, code assist will fill the arguments with the
Off
Option
Default
Insert best guessed arguments Sort proposals Hide proposals not visible in the invocation context Show camel case matches Hide forbidden references Hide discouraged references Hide deprecated references Enable auto activation
If selected, code assist will fill the arguments with the best Off matching variable, field or method invocation from the context where a method proposal is inserted. Select how the proposals should be sorted in the content assist pop up. If enabled, the Java element proposals are limited by the rules of visibility. For example, private field proposals of other classes would not be displayed. If enabled, camel case matches are displayed (i.e. NPE is expanded to NullPointerException). If enabled, references to Java elements forbidden by access rules are not displayed. If enabled, references to Java elements discouraged by access rules are not displayed. by relevance On
On On Off
If enabled, references to deprecated Java elements are not Off displayed. If enabled, code assist can be invoked automatically. The condition for automatic invocation is specified with the preferences Auto activation delay, Auto activation triggers for Java and Auto activation triggers for Javadoc. On
If the time starting when an auto activation trigger character is encountered until a new character is typed exceeds the auto activation delay, code assist is invoked.
200
If one of the trigger characters is typed inside Java source '.' code (but not inside a Javadoc comment) and no other character is typed before the auto activation delay times out, the code assist is invoked. If one of the trigger characters is typed inside a Java doc and no other character is typed before the auto activation delay times out, the code assist is invoked. '@#'
Content/Code Assist
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Editor > Content Assist
Indicate your preferences for the Advanced settings on the Advanced preference page. Option Description
Default Other Java Proposals, SWT Template Proposals, Template Proposals, Type Proposals Template Proposals, SWT Template Proposals
Select the proposal Select all the proposal kinds which are contained in kinds contained in the content assist list when invoking content assist the 'default' content the first time with Ctrl+Space. assist list Content assist cycling Select the proposal kinds to cycle through and the cycle order when repeatedly invoking content assist (Ctrl+Space). Select a proposal kind and invoke Up or Down to change the order.
If a parameter name could not be fetched from 50 ms attached Javadoc within the specified amount of time then the attempt to fetch it is abandoned. Increase the value if you have problems fetching the name, for instance due to a slow network connection.
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Editor > Content Assist
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Editor
Description If enabled, different sections in the Java editor can be folded and expanded. If enabled, comments are folded when opening a new editor. If enabled, header Comments are folded when opening a new editor. If enabled, inner types are folded when opening a new editor. If enabled, Java members are folded when opening a new editor. If enabled, imports are folded when opening a new editor.
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Editor
Default
Description
Default
content. A key modifier can be given to each hover type to Hover, Source force the editor to only evaluate this hover when pressing the (with Shift) assigned key modifier.
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Editor
Default On
A list of elements can be enabled and disabled on this preference page. All are enabled by default.
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Editor
Perform the If enabled, then the selected actions below will be executed on save. selected actions on save Format source code If enabled, then the source code will be formatted on each save. The code will be formatted according to the active profile selected on the
Off
Option
Default
If selected, all lines in the file will be formatted on save. If selected, only the lines that have been modified since the last save are formatted on save. If enabled, then the imports will be organized on each save. Change the organize import settings on the Java > Code Style > Organize Imports preference page. If enabled, then additional actions will be executed on save. To add and remove actions select Configure....
On Off On
Additional actions
Off
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Editor
Element Each category (Java, Javadoc and Comments) contains a list of language elements that may be rendered with its own color and style. Note that some semantic highlighting options can be disabled by the user in order to ensure editor performance on low-end systems.
Preview Displays the preview of a Java source code respecting the current colors n/a and styles.
Java editor
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Editor
Template editing Java content assist Task tag preferences Code templates preferences Code style preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Editor
Indicate your preferences for the Typing settings on the page. Option Automatically close
Description Select for which characters a closing character should be inserted when typing the opening character.
Automatically insert at correct Select which characters should be automatically inserted position when they are required. Tab key adjusts the indentation of the current line Adjust indentation Update imports Wrap automatically Escape text when pasting into a string literal If enabled then the tab key can be used to indent the current line. When pasting Java code from the clipboard adjust its indentation to the current indentation level. When pasting Java code from the clipboard add the required import statements to the import section. If enabled, string literals are wrapped when they exceed the max line length.
If enabled, special characters in pasted strings are escaped Off when they are pasted into an existing string literal.
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java
Classpath Variables Debugger Java perspectives Java views Local debugging Remote debugging
Working with JREs Adding a new JRE definition Deleting a JRE definition Assigning the default JRE for the workbench Choosing a JRE for launching a project Launching a Java program Running and debugging
Execution Environment Preferences Java Debug Preferences Run/Debug Preferences Source Attachment
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java > Installed JREs
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java
JUnit Preferences
The Java > JUnit preference page lets you configure the stack trace filter patterns for JUnit. The patterns are used in the JUnit view to control which entries are visible in stack traces. Action Description
Enable assertions for If enabled, then JUnit test will be launched with assertions enabled. new JUnit launch configurations Add Filter Add Class... Add Packages... Allows to add a custom filter pattern. This action inserts an empty pattern which can be edited. Allows to add classes to be filtered. This action opens the Open Type dialog to choose a type to be filtered in the stack traces. Allows to add packages to be filtered. This action opens a package selection dialog to choose the packages to be filtered in the stack traces. Removes the currently selected stack trace filter pattern. Enables all stack trace filter patterns. Disables all stack trace filter patterns.
Using JUnit
Open type
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Java
Element A list of elements that may be rendered with its own foreground color and style. Preview Displays the preview of a properties file respecting the current colors and styles.
Debug Preferences
The following preferences can be set using the Run/Debug preference page. The preferences here are generic to all debuggers, and govern stylistic and prompting options Option Reuse editor when displaying source code Description Default
The debugger displays source code in an editor when stepping On through an application. When this option is on, the debugger will reuse the editor that it opened to display source from different source files. This prevents the debugger from opening an excessive number of editors. When this option is off, the debugger will open a new editor for each source file that needs to be displayed. This option brings attention to the debugger when a breakpoint is On encountered, by activating the associated window. The visual result varies from platform to platform. For example, on Windows, the associated window's title bar will flash. This option brings attention to the debug view when a breakpoint is encountered. If the view is already open it will be activated. If On
Activate the workbench when when a breakpoint is hit Activate the debug view when a
breakpoint is hit
Skip breakpoints This option controls whether breakpoints are ignored when during a 'Run to Line' performing a 'Run to Line' operation. When the option is on, the operation debugger does not suspend at breakpoints encountered when a 'Run to Line' operation is invoked. When the option is off, breakpoints behave normally. Prompt for conformation when deleting all breakpoints Prompt for confirmation when deleting breakpoint containers Changed value colour Changed value background colour Memory unbuffered colour Memory buffered colour This option controls whether you will be prompted for confirmation when you try to delete all of your breakpoints
On
This option controls if you will be prompted for confirmation when you try to delete a breakpoint container, e.g. a breakpoint working set This option allows you to change the colour of a changed value in the variables view, expressions view, memory view, anywhere running program variables are rendered
On
Red
This option allows you to change the selection colour of a changed Yellow variable, e.g. in the variables view showing columns This option allows you to change the rendering colour of unbuffered memory blocks in the memory view This option allows you to change the rendering colour of buffered memory blocks in the memory view Grey Black
Console Preferences Installed JREs Preferences Java Debug Preferences Launching Preferences Perspectives Preferences String Substitution Preferences View Management Preferences
-----------------------------------------------------------------------------
Java development user guide > Reference > Preferences > Run/Debug
Console Preferences
The following preferences can be set using the Run/Debug > Console preference page. The console displays output from running applications, and allows keyboard input to be read by running applications. Option Fixed width console Description This preference controls whether the console has a fixed character width. When on, a maximum character width must also be specified. Some applications write long lines to the console which require horizontal scrolling to read. This can be avoided by setting the console to use a fixed width, automatically wrapping console output. This preference limits the number of characters buffered in the console. When on, a maximum buffer size must also be specified. When console output surpasses the specified maximum, output is truncated from the beginning of the buffer. Allows the default width, in characters, of a tab to be specified Default Off
On
8 On
Show When This preference will force the console to show when something is Program Writes to written to the system out stream. A forced-show can mean that a Standard Out console will be opened, or that the console will be brought to the top if it is already open. Show When This preference will force the console to show when something is Program Writes to written to the system err stream. A forced-show can mean that a Standard Error console will be opened, or that the console will be brought to the top if it is already open. Standard Out Text This preference controls the colour of text written to the standard Color output stream by an application. Standard Error Text Color Standard In Text Color Background Colour This preference controls the colour of text written to the standard error stream by an application.
On
Black Red
This preference controls the colour of text typed into the console to be Green read by an application. This preference controls the colour of the background of the console White
You can also click the Change button to set the font for the Console.
Console View Installed JREs Preferences Java Debug Preferences Launching Preferences Perspectives Preferences Run/Debug Preferences String Substitution Preferences View Management Preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Run/Debug
Launching Preferences
These preferences allow you to configure options related to launching programs in general, and govern such things as waiting for builds, saving files before launching, etc. The following preferences can be set using the Option Save required dirty editors before launching Run/Debug > Launching preference page. Description This option controls whether the user will be prompted to save any dirty editors before an application is launched. The allowable settings are:
Default Prompt
Always - when this option is selected, the user is never prompted to save dirty editors, and editors are automatically saved. Never - when this option is selected, the user is never prompted to save dirty editors, and editors are not automatically saved. Prompt - when this option is selected, the user is prompted to save dirty editors before launching an application. Always
This option controls whether a launch will wait for an already executing build to complete before launching an application. The allowable settings are:
Always - when this option is selected, a launch will always wait for the pending build to complete Never - when this option is selected, a launch will never wait for the pending build to complete
Prompt - when this option is selected, the user is prompted to wait for the pending build to complete when they launch Never
This option controls whether a launch will be performed in debug mode, even when run is pressed, when the workspace contains breakpoints. The allowable options are:
Always - when this option is selected, a launch will always be performed in debug mode when breakpoints are present, no matter which launch button is pressed (run or debug) Never - when this option is selected, a launch will always be performed in the user specified mode Prompt - when this option is selected, the user is prompted to launch in debug mode when the workspace contains breakpoints Prompt
This option controls whether a launch should be performed when a related project contains an error. The allowable options are:
Always - when this option is selected, a launch will continue in the face of compilation errors Prompt - when this option is selected, the user is prompted to proceed with a launch when relevant compilation errors are in an associated project On On
Build (if required) before launching Remove terminated launches when a new launch is created Size of recently launched applications list Launch Operation
If the workspace requires building, an incremental build will be performed prior to launching an application. When an application is launched, all terminated applications in the Debug view are automatically cleared.
This option controls how many launches will appear in the 10 Run/Debug pull-down launch history menus. New in 3.3 is the ability to launch the selected resource or Launch editor. The launch operation preference allows users to Selected with switch between using the old 'always launch last' behavior Launch Project and the new 'launch selected resource or editor' behavior. If the preference to use launch selected resource or editor is selected, you can then customize what happens if the selected resource or editor is not launchable. There are two choices for this 1. try to launch the parent project of the resource or editor 2. launch the previous thing you launched.
Run and Debug toolbar actions Console Preferences Default Launchers Preferences Installed JREs Preferences Java Debug Preferences Launch Configurations Preferences Perspectives Preferences Run/Debug Preferences String Substitution Preferences View Management Preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Run/Debug > Launching
Installed JREs Preferences Java Debug Preferences Launch Configurations Preferences Launching Preferences Run/Debug Preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Run/Debug > Launching
On
Filter all configurations of the selected type regardless of the other Off filtering options. For example if you specify to filter Java type configurations, all Java type configurations will be filtered from the UI, not just ones that fall under the other filtering categories. On
Delete configurations Any launch configurations associated with a project being deleted when associated will also be deleted if this option is enabled. Once deleted the project is deleted configurations are not recoverable. Migration As Eclipse matures and new features are added to the launching framework, there sometimes exists the need to make changes to launch configurations. Some of these changes are made automatically, but those that are not (nonreversible ones) are left up to the end-user. The migration section allows users to self-migrate any launch configurations that require it. Upon pressing the Migrate... button, if there are any configurations requiring migration, they are presented to the user, and the user can select the ones they want to migrate. Configuration migration is not un-doable.
Default Launchers Preferences Installed JREs Preferences Java Debug Preferences Launching Preferences Run/Debug Preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Run/Debug
Perspectives Preferences
The following preferences can be set using the Run/Debug > Perspectives preference page. The preferences on this page allow you to set which, if any perspectives are automatically opened when launchers are used in certain modes Option Open the associated perspective when launching Description This option controls if the specified perspective will be switched to automatically or not when launching
Default Never
Always - the specified perspective will always be opened Never - the specified perspective will never be opened Prompt - the user will be prompted to switch to the specified perspective Prompt
This option controls if the specified perspective will be switched to when the application susupends
Always - the specified perspective will always be opened Never - the specified perspective will never be opened Prompt - the user will be prompted to switch to the specified perspective
Launcher / Perspective This option area allows you to customize what perspective will be choices opened for a given launch and mode that it supports. For example, you can say that you want to open the Java perspective when using the Java JDT launcher in the run mode only.
Console Preferences Installed JREs Preferences Java Debug Preferences Launching Preferences Run/Debug Preferences String Substitution Preferences View Management Preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Run/Debug
In this case the TEST variable does nothing, but in the 'real' world it could point to a directory or program that you would like to reuse the path for in configurations, etc. If we now want to leverage this new variable, we can do so from the launch dialog on the arguments tab (for those configurations that have a standard arguments tab), by selecting the Variables... button for either the program or VM arguments text area. Selecting the Variables button opens a dialog with a listing of all of the string variables available. In the following screen shot we can see the TEST variable available in the list.
We can now select the TEST variable and insert in as an argument if we wish, as shown in the following screen shot.
The other mentioned platform use of string substitution in in the External Tools launch dialog, used with Ant configurations, as shown in the following screen shot.
Console Preferences Installed JREs Preferences Java Debug Preferences Launching Preferences Perspectives Preferences
----------------------------------------------------------------------------Java development user guide > Reference > Preferences > Run/Debug
Console Preferences Installed JREs Preferences Java Debug Preferences Launching Preferences Perspectives Preferences Run/Debug Preferences String Substitution Preferences
-----------------------------------------------------------------------------
Property Pages
Contents
Javadoc Location Java Build Path Java Compiler Java Task Tags Source Attachment Run / Debug
Select a JAR or Java project, open the context menu and select Properties > Javadoc Location or use Properties from the File menu In the Javadoc generation wizard, on the Standard doclet settings page, choose Configure
Javadoc can be attached to JARs, class folders or Java projects. For projects it documents the elements of all source folders, for JARs and class folders, elements contained in the JAR are documented. The location is used by
Open External Javadoc in the Navigate menu to find the Javadoc location of an element Context Help (F1) to point to a Javadoc location Javadoc Export Wizard to link to other documentation or as default destination for a project's documentation
Valid locations are URLs that point to a folder containing the API documentation's index.html and package-list file. Examples are: file:///M:/JAVA/JDK1.2/DOCS/API/ http://java.sun.com/j2se/1.4/docs/api/ Option Javadoc URL Validate Description Specify the location of the generated Javadoc documentation. You can Browse in the local file system for a Javadoc location (will result in a file:// URL) Validate the current location by trying to access the index.html and packagelist file with the given URL. If the validation was successful, you can directly open the documentation. Default <empty>
Javadoc for JARs and class folders can also be located inside an archive available on the local file system. In that case the location of the archive as well as the location of the doc inside the archive has to be specified. Option Archive location Path within archive Validate Description Specify the location of the archive that contains the generated Javadoc documentation. You can Browse in the local file system for a Javadoc location Specify the path inside the archive that contains the generated Javadoc documentation. You can Browse to see the content of the archive. Validate the current location by trying to access the index.html and package-list file with the given URL. If the validation was successful, you can directly open the documentation. Default <empty>
<empty>
----------------------------------------------------------------------------Java development user guide > Reference > Wizards and Dialogs > Create New Elements > New Java Project Wizard
Source tab
Source folders are top-level folders in the project hierarchy. They are the root of packages containing .java files. The compiler will translate the contained files to .class files that will be written to the output folder. Source folders allow to structure the project, for example to separate test from the application in two source folders. Within a source folder, a more detailed structuring can be acived by using packages. Each source folder can define an exclusion filter to specify which resources inside the folder should not be visible to the compiler. Resources existing in source folders are copied to the output folder unless the setting in the Java > Compiler > Building preference page specifies that the resource is filtered. The output folder is defined per project except if a source folder specifies its own output folder.
Source folder options: Option Add Folder Link Source Edit Remove Creates a new folder to contain source Creates a new folder that links to an location outside of the workspace Allows to modify the currently selected source folder or source folder attribute. Removes the selected folders from the class path. This does not delete the folders nor their contents. Description
Source folder attributes: Attribute Exclusion filter Output folder Native library location Description Selects which resources are not visible to the compiler Only available when Allow output folder per source folder is checked. Defines a source folder specific output location. If not set the project's default output folder is used. Defines the folder that contains the native libararies (for example 'dll' or 'o' files) required at runtime by the sources in the source folder.
At the bottom of this page, the Default output folder field allows you to enter a path to a folder path where the compilation output for this project will reside. The default output is used for source folders that do not specify an own output folder. Use Browse to select an existing location from the current project.
Projects tab
In the Required projects on the build path list, you can add project dependencies by selecting other workbench projects to add to the build path for this new project. Adding a required project indirectly adds all its classpath entries marked as 'exported'. Setting a classpath entry as exported is done in the Order and Export tab. The projects selected here are automatically added to the referenced projects list. The referenced project list is used to determine the build order. A project is always build after all its referenced projects are built.
Action Add Edit Remove Description Add another project in the workspace to the build path of this project. Edit the classpath attribute of a required project. Removes the selected required projects from the list. Project entry attributes: Attribute Native library location Access rules Description Specifies where native library required for the project to operate can be found. Specifies access rules for project contained in the library. This allows to hide content of a project.
Libraries tab
On this page, you can add libraries to the build path. By default, the library list contains an entry representing the Java runtime library. This entry points to the JRE selected as the default JRE. The default JRE is configured in the Java > Debug > Installed JREs preferences page.
Libraries tab options: Option Add JARs Add External JARs Add Variable Description Allows you to navigate the workbench hierarchy and select JAR files to add to the build path. Allows you to navigate the file system (outside the workbench) and select JAR files to add to the build path. Allows you to add classpath variables to the build path. Classpath variables are an indirection to JARs with the benefit of avoiding local file system paths in a classpath. This is needed when
projects are shared in a team. Variables can be created and edited in the Java > Build Path > Classpath Variables preference page. Add Library Add Class Folder Add External Class Folder Edit Remove Migrate JAR File Allows to add a predefined libraries like the JRE System Library. Such libraries can stand for an arbitrary number of entries (visible as children node of the library node) Allows to navigate the workbench hierarchy and select a class folder for the build path. The selection dialog also allows you to create a new folder. Allows to navigate the file system (outside the workbench) and select a class folder for the build path. The selection dialog also allows you to create a new folder. Allows you to modify the currently selected library entry or entry attribute Removes the selected element from the build path. This does not delete the resource. Migrate a JAR on the build path to a newer version. If the newer version contains refactoring scripts the refactoring stored in the script will be executed.
Libraries have the following attributes (presented as library entry children nodes):
Library entry attributes: Attribute Javadoc location Source attachment Native library location Access rules Description Specifies where the library's Javadoc documentation can be found. If specified you can use Shift+F2 on an element of this library to open its documentation. Specifies where the library's source can be found. Specifies where native library required for the library to operate can be found. Specifies access rules for resources contained in the library. This allows to hide content of a library.
Frequently asked questions on JDT Classpath variables preferences Build path preferences Compiler preferences
The options in this page indicate the compiler settings for a Java project. You can reach this page through the
Java Compiler property page (File > Properties > Java Compiler) from the context menu on a created project or the File menu
A project can either reuse workspace default settings or use its own custom settings. Option Description
Enable project Once selected, compiler settings can be configured for this project. All Java specific settings compiler preferences can be customized. At any time, it is possible to revert to workspace defaults, by using the button Restore Defaults.
Build classpath
Java compiler preferences Java Build Path properties Frequently asked questions on JDT
Java task tags property page (File > Properties > Java Compiler > Task Tags) from the context menu on a created project or the File menu
A project can either reuse workspace default settings or use its own custom settings. Option Enable project specific settings Description Once selected, task tags can be configured for this project as in the Task tags preference page. At any time, it is possible to revert to workspace defaults, by using the button Restore Defaults.
-----------------------------------------------------------------------------
Java development user guide > Reference > Wizards and Dialogs > Create New Elements > New Java Project Wizard
Depending of how a JAR was contributed to the classpath, you can see different types of Source attachment dialogs:
JAR
In the Location path field, enter the path of an archive or a folder containing the source. Use either the Workspace, External File or the External Folder button to browse for a location.
Variable
In the Location Variable Path field enter a variable path that points to the source attachment's location. A variable path has as first segment a variable (which will resolve to a folder or file), the rest is an optional path extension (e.g.MYVARIABLE/src.jar ). Use either the Variable button to select an existing variable and the Extension button to select the extension path. The Extension button is only enabled when the variable can be extended (resolves to a folder) JRE_SRC is a reserved variable that points to a JRE selected in the Installed JREs preference page ( Java > Installed JREs). Go to this preference page to configure the source attachment for the JRE's library..
Build classpath
Description The list shows all of the launch configurations in the current workspace that apply to the property pages' corresponding resource. The New... button can be used to create a new launch configuration that applies to the corresponding resource. When selected, the New... button will present you with a dialog of all of the launch configuration types that can be used to make a configuration that applies to the corresponding resource. The Duplicate button is used to make an identical copy of a selected launch configuration. The Edit... button will open the launch configuration edit dialog, allowing you to change the selected launch configuration. The Delete button is used to delete the selected launch configuration.
Launching a Java Program Launching a Java program in debug mode Preparing to Debug Re-launching a program Launching a Java applet Disconnecting from a VM Using the remote Java application launch configuration
Refactoring Support
The goal of Java program refactoring is to make system-wide code changes without affecting the behavior of the program. The Java tools provide assistance in easily refactoring code. The refactoring tools support a number of transformations described in Martin Fowler's book Refactoring: Improving the Design of Existing Code, Addison Wesley 1999, such as Extract Method, Inline Local Variable, etc.. To get an overview of all offered refactorings look at the Refactor menu. Refactoring commands are also available from the context menus in many views or appear as quick assists. When performing a refactoring operation, you can optionally preview all of the changes resulting from a refactoring action before you choose to carry them out. When previewing a refactoring operation, you will be notified of potential problems and will be presented with a list of the changes the refactoring action will perform. If you do not preview a refactoring operation, the change will be made in its entirety and any resultant problems will be shown. If a problem is detected that does not allow the refactoring to continue, the operation will be halted and a list of problems will be displayed. Refactoring commands are available from the context menus of several Java views (e.g. Package Explorer, Outline) and editors. Many "apparently simple" commands, such as Move and Rename, are actually refactoring operations, since moving and renaming Java elements often require changes in dependent files. Refactorings can not only be performed interactively, but also from refactoring scripts. Most refactorings available in the Refactor menu are stored in the workspace refactoring history in order to be used in refactoring scripts afterwards. The refactoring tools support the creation of refactoring scripts based on refactorings in the workspace refactoring history. Refactoring scripts can then be applied to an arbitrary workspace. Applying a refactoring script launches a refactoring wizard which is able to replay the refactorings as if they had been initiated by the user which originally had created them. Related to refactoring scripts, the refactoring tools offer a refactoring to migrate a JAR File to a newer version, using refactoring information to avoid breaking changes in your workspace after the migration.
Refactoring actions Refactoring wizard Java preferences ----------------------------------------------------------------------------Java development user guide > Reference > Refactoring
Refactor Actions
Refactor menu commands: Name Rename Description Renames the selected element and (if enabled) corrects all references to the elements (also in other files). Available: Methods, method parameters, fields, local variables, types, type parameters, enum constants, compilation units, packages, source folders, projects and on a text selection resolving to one of these element types Shortcut: Options: Alt + Shift + R Renaming a type does allow to rename similarly named variables and methods. Enable 'Update similarly named variables and methods' in the Rename Type dialog. Select 'Configure...' to configure the strategy for matching type names. Renaming a package does allow to rename its subpackages. Enable 'Rename subpackages' in the Rename Package dialog. Enable 'Keep original method as delegate to changed method' to keep the original method. Optionally you can deprecate the old method. Move Moves the selected elements and (if enabled) corrects all references to the elements (also in other files). Available: Instance method (which can be moved to a component), one or more static methods, static fields, types, compilation units, packages, source folders and projects and on a text selection resolving to one of these element types Shortcut: Options: Change Method Signature Alt + Shift + V You can use Drag & Drop in the Package Explorer to start this refactoring.
Changes parameter names, parameter types, parameter order and updates all references to the corresponding method. Additionally, parameters and thrown exceptions can be removed or added and method return type and method visibility can be changed. Available: Methods or on text selection resolving to a method Shortcut: Options: Alt + Shift + C Enable 'Keep original method as delegate to changed method' in the Change Method Signature dialog to keep the original method.
Extract Method
Creates a new method containing the statements or expression currently selected and replaces the selection with a reference to the new method. This feature is useful for cleaning up lengthy, cluttered, or overly-complicated methods. Available: You can use Expand Selection to from the Edit menu to get a valid selection range. This refactoring is also available as quick assist on statements and expressions selected in the editor. Shortcut: Alt + Shift + M
Creates a new variable assigned to the expression currently selected and replaces the selection with a reference to the new variable. Available: Text selections that resolve to local variables. You can use Expand Selection to from the Edit menu to get a valid selection range. This refactoring is also available as quick assist on expressions selected in the editor. Shortcut: Alt + Shift + L
Extract Constant
Creates a static final field from the selected expression and substitutes a field reference, and optionally rewrites other places where the same expression occurs. Available: Constant expressions or text selections which resolve to constant expressions This refactoring is also available as quick assist on expressions selected in the editor. Inline local variables, methods or constants. Available: Methods, static final fields and text selections that resolve to methods, static final fields or local variables This refactoring is also available as quick assist on local variables selected in the editor. Shortcut: Alt + Shift + I
Inline
Converts an anonymous inner class to a member class. Available: Anonymous inner classes Creates a new Java compilation unit for the selected member type, updating all references as needed. For non-static member types, a field is added to allow access to the former enclosing instance, if necessary. Available: Member types or text resolving to a member type. This refactoring is also available as quick assist on member classes selected in the editor. Turn a local variable into a field. If the variable is initialized on creation, then the operation moves the initialization to the new field's declaration or to the class's constructors. Available: Text selections that resolve to local variables. This refactoring is also available as quick assist on local variables selected in the editor. Extracts a common superclass from a set of sibling types. The selected sibling types become direct subclasses of the extracted superclass after applying the refactoring.
Extract Superclass
Available: Types Options: Enable 'Use the extracted class where possible' to use the newly created class wherever possible. See Use Supertype Where Possible.
Extract Interface
Creates a new interface with a set of methods and makes the selected class implement the interface. Available: Types Options: Enable 'Use the extracted interface type where possible' to use the newly created interface wherever possible. See Use Supertype Where Possible.
Replaces occurrences of a type with one of its supertypes after identifying all places where this replacement is possible. Available: Types Moves a set of methods and fields from a class to its subclasses. Available: One or more methods and fields declared in the same type or on a text selection inside a field or method Moves a field or method to a superclass of its declaring class or (in the case of methods) declares the method as abstract in the superclass. Available: One or more methods, fields and member types declared in the same type or on a text selection inside a field, method or member type Replaces a set of fields with new container object. All references to the fields are updated to access the new container object. Available: The set of fields or a type containing fields Options: Enable 'Create Getter and Setters' to add accessor methods to the new type
Push Down
Pull Up
Extract Class
Introduce Replaces a set of parameters with a new class, and updates all callers of the Parameter Object method to pass an instance of the new class as the value to the introduce parameter. Available: Methods or on text selection resolving to a method Options: Introduce Indirection Enable 'Keep original method as delegate to changed method' in the Introduce Parameter Object dialog to keep the original method.
Creates a static indirection method delegating to the selected method. Available: Methods or on text selection resolving to a method Options: Enable 'Redirect all method invocations' to replace all calls to the original method by calls to the indirection method.
Introduce Factory Creates a new factory method, which will call a selected constructor and return the created object. All references to the constructor will be replaced by calls to the new factory method. Available: Constructor declarations Introduce Parameter Replaces an expression with a reference to a new method parameter, and updates all callers of the method to pass the expression as the value of that parameter.
Available: Text selections that resolve to expressions Encapsulate Field Replaces all references to a field with getter and setter methods. Available: Field or a text selection resolving to a field. This refactoring is also available as quick assist on field declarations and references selected in the editor. Generalize Declared Type Allows the user to choose a supertype of the reference's current type. If the reference can be safely changed to the new type, it is. Available: Type references and declarations of fields, local variables, and parameters with reference types Replaces raw type occurrences of generic types by parameterized types after identifying all places where this replacement is possible. Available: Projects, packages, and types Options: 'Assume clone() returns an instance of the receiver type'. Wellbehaved classes generally respect this rule, but if you know that your code violates it, uncheck the box. 'Leave unconstrained type arguments raw (rather than inferring <? >)'. If there are no constraints on the elements of e.g. ArrayList a, uncheck this box will cause Eclipse to still provide a wildcard parameter, replacing the reference with ArrayList<?>. Migrate JAR File Migrates a JAR File on the build path of a project in your workspace to a newer version, possibly using refactoring information stored in the new JAR File to avoid breaking changes. Available: JAR Files on build path Create Script Creates a script of the refactorings that have been applied in the workspace. Refactoring scripts can either be saved to a file or copied to the clipboard. See Apply Script. Available: Always Applies a refactoring script to projects in your workspace. Refactoring scripts can either be loaded from a file or from the clipboard. See Create Script. Available: Always Browses the workspace refactoring history and offers the option to delete refactorings from the refactoring history. Available: Always
Apply Script
History
Refactoring commands are also available from the context menus in many views and the Java editor.
Refactoring support
Refactoring Wizard
A dialog based user interface guides you through the steps necessary to execute a selected refactoring. Depending on the complexity of the refactoring, either a wizard or a simple dialog is used to gather information that is required for the refactoring.
Input pages
The input pages gather information that is required for the refactoring. After you have provided the required input you can click Ok or Finish to carry out the refactoring without previewing the results. If you want to preview the changes press Preview or Next
Preview page
The JDT allows you to preview the results of a refactoring action before you execute it. The preview page consists of two parts:
A tree at the top containing all Java elements affected by the refactoring. Each top-level node in the tree represents one compilation unit. Some refactorings allow to filter the tree by different kind of changes made by the refactoring. Use the Filter Changes drop down to change the filtering.
A compare viewer at the bottom. The left side of the compare viewer shows the original, the right side displays the refactored source.
Problem page
The Refactoring Problem page indicates if there are suspected, potential, or definite problems with the refactoring action you are attempting. Four types of problems are possible:
Information A problem described as Information will not affect the refactoring in any way, nor will it negatively affect the code in the workbench. You can most likely ignore this type of problem. Warnings Warnings attempt to predict compiler warnings. This type of problem most likely will not negatively affect the code in your workbench. Errors A problem described as an Error is very likely to cause compiler errors or change your workbench code semantically. You can choose to continue with the refactoring in spite of these errors, although it is not recommended. Stop problems This type of problem prevents the refactoring from taking place. For example, if you select a comment and choose the Extract Method command from it, the workbench will issue a stop problem on the refactoring attempt because you cannot extract a comment.
If there aren't any stop problems then the refactoring can be carried out by pressing the Finish button. To preview the results of the refactoring action, press the Next > button.
Refactoring support
A local type declaration is not part of the selection but is referenced by one of the statements selected for extraction. Either extend the selection that it includes the local type declaration or reduce the selection that no reference to the local type declaration is selected.
Selected block references a local type declared outside the selection A local type declared in the selected block is referenced outside the selection The selection covers a local type declaration but the type is also referenced
outside the selected statements. Either extend the selection that is includes all references to the local type or reduce the selection that the local type declaration isn't selected.
Ambiguous return value: selected block contains more than one assignment to local variable More than one assignment to a local variable was found inside the
selected block. Either reduce the selection that only one assignment is selected or extend the selection that at least all reference except of one to the local variables are covered by the selection too.
Ambiguous return value: expression access to local and return statement selected The selected statement generates more than one return value. This is for example
the case if an expression is selected and an expression's argument is modified as well. To remedy this problem extend the selection to cover the read access of the modified argument as well.
Selection contains a break statement but the corresponding break target isn't selected To remedy the problem either extend the selection to include the break
continue target or reduce the selection that the break / continue statement isn't covered by the selection.
Selection contains a continue statement but the corresponding continue target isn't selected To remedy the problem either extend the selection to include
the
break / continue target or reduce the selection that the break / continue statement isn't covered by the selection. Selection starts inside a comment Parts of a comment cannot be extracted. Either extend the selection that it covers the whole comment or reduce the selection that the comment isn't covered at all.
Parts of a comment can't be extracted. Either extend the selection that it covers the whole comment or reduce the selection that the comment isn't covered at all. Cannot extract selection that ends in the middle of a statement Adjust selection so that it fully covers a set of statements or expressions. The users can extend the selection to a valid range using the Expand Selection to in the Edit menu.
Selection ends inside a comment
Search
Contents
Search string
In this field, type the expression for which you wish to search, using the wildcard characters mentioned in the dialog as needed. This field is initialized based on the current selection.
Depending on what is searched for, the search string should describe the element: o Type: the type name (may be qualified or not). Examples: org.eclipse.jdt.internal.core.JavaElement Foo Method: the defining type name (may be qualified or not as for Type search, optional), the method selector and its parameters (optional). Examples:
MyClass.Inner
o o
foo Package: the package name for a package (e.g. org.eclipse.jdt.internal.core) Constructor: the defining type name (may be qualified or not as for Type search, optional) and the constructor parameters (optional). Examples: org.eclipse.jdt.internal.core.JavaElement(JavaElement, String)
Foo
Note that the constructor name should not be entered as it is always the same as the type name.
Field: the defining type name (qualified or not as for Type search, optional) and the field name. Examples: org.eclipse.jdt.internal.core.JavaElement.name
foo
From the drop-down menu, you can choose to repeat (or modify) a recent search. Select the Case sensitive field to force a case aware search. Case sensitive is enabled when a custom search string is entered.
Search For
Select to search for one of the following kinds of elements:
Type Method Package Constructor Field
Limit To
Select to limit your search results to one of the following kinds of matches:
Declarations Implementors (available only when searching for types) References All occurrences Read access (available only when searching for fields) Write access (available only when searching for fields) Match locations (available only when searching for types). Match locations allow to further narrow the location of matches. Select the location where to search for the type reference. o Super class declarations o Annotations o Field types o Local variable types o Method return types o Method parameter types o Thrown exception types o Type parameter bounds o Wildcard bounds o Type argument o Cast expressions o Catch clauses o Class instance creations o 'instanceof' checks
Search In
Select where in the scope to search for results
Sources: Search in all source files in the scope Required projects: Search in all required projects JRE libraries: Search in JRE libraries on the build path Application libraries: Search in libraries on the build path
Scope
Select to limit your search results to one of the following scope
Workspace Selected resources Enclosing Projects Working Set
Java search
Search
Search Actions
Search menu commands: Name Search... File... Java... Text Opens the search dialog Opens the search dialog on the File search page Opens the search dialog on the Java search page Searches for the selected text in the chosen scope:
Function
References
Finds all references to the selected Java element in the chosen scope:
Declarations
scope:
Implementors
Finds all implementors of the selected interface in the chosen scope: (Workspace, Project or Working Set)
Read Access
Finds all read accesses to the selected field in the chosen scope:
Write Access
Finds all write accesses to the selected field in the chosen scope:
Occurrences in File
Identifier: Occurrences of all identifiers resolving to the selected element Implementing Methods: All methods implemented by the selected super-interface declaration Throwing Exceptions: All statements that possible throw Ctrl + Shift + U the selected declared exception Method Exits: All statements that can exit the method of the selected return type Break/Continue Target: The targets of the selected break and continue statement
Referring Tests
Finds all JUnit tests that refer to the currently selected type
Search scopes submenu: Scope Workspace Project Hierarchy Availability all elements all elements Description Searches in the full workspace Searches in the project enclosing the selected element
Scopes can be saved and names in the working set dialog. Existing instances of working sets are also available in the Search Scope submenu A Java search can also be conducted via the context menu of all Java views. The search context menu is also available in the Java editor. The search is only performed if the currently selected text can be resolved to a Java element. The type of the selected Java element defines which search context menus are available. The Java editor does not constrain the list of available Java searches based on the selection.
Java search
Toolbar
Contents
Java Toolbar Actions Java Editor Toolbar Actions Run and Debug Toolbar Actions
This command helps you create a new Java package. See new Java package wizard
This command helps you create a new Java class. See new Java class wizard
This command helps you create a new Java enum. See new Java enum wizard
This command helps you create a new Java interface. See new Java interface wizard
This command helps you create a new Java annotation. See new Java annotation wizard
This command helps you create a new JUni test case. This command allows you to browse the workspace for a type to open in the defined default Java editor. You can optionally choose to display the type simultaneously in the Hierarchy view. See Open Type dialog.
New Java project wizard New Java package wizard New Java class wizard New Java enum wizard New Java interface wizard New Java annotation wizard New Java scrapbook page wizard Views and editors
Java editor
Toolbar actions
Toolbar Button Command Toggle Java Editor Breadcrumb Toggle Mark Occurrences Toggle Block Selection Mode Show Whitespace Characters Show Source of Selected Element Only Description This button enables the Java editor breadcrumb. The enablement is remembered for each perspective separately. Turns mark occurrences on and off in the Java editor. This button enables block (aka column) selection mode in the editor. This button enables the display of whitespace characters in an editor. This button enabled display of a segmented view of the source of a compilation unit. This button is only shown if you customize your perspective to show the Editor Presentation actions. For example, if a method is selected in the Outline view, the Show Source Of Selected Element Only option causes only that method to be displayed in the editor, as opposed to the entire class. Off: The entire compilation unit is displayed in the editor, with the selected Java element highlighted in the marker bar with a range indicator. On: Only the selected Java element is displayed in the editor, which is linked to the selection in the Outline or Hierarchy view. Go to Next Problem This command navigates to the next problem marker in the active editor. Go to Previous Problem This command navigates to the previous problem marker in the active editor.
Description Deletes from the cursor position to the beginning of the line. Deletes from the cursor position to the end of the line. Sets a mark at the current cursor position. Swaps the cursor and mark position if any.
Java editor
Java outline Java editor preferences JDT actions Views and editors
Debug
Running and Debugging Connecting to a remote VM with the Remote Java application launch configuration Line breakpoints Setting method breakpoints Catching exceptions
Changing the appearance of the console view Opening an editor for a selected element Opening an editor on a type
Java editor actions Breakpoints view Console view Debug view Display view Expressions view Java editor Package explorer view Variables view Java outline Java scrapbook Page Type hierarchy view Call hierarchy view
Breakpoints View
The Breakpoints View lists all the breakpoints you currently have set in your workspace.
You can double-click a breakpoint to display its location in the editor (if applicable). You can also enable or disable breakpoints, delete them, add new ones, group them by working set, or set hit counts. In the example shown below the Group by > Breakpoint Types option is turned on.
The commands available in the Breakpoints View are listed below. Breakpoints View Commands Command Name Access Add Exception Breakpoint Breakpoint Properties... Caught Description Changes if the selected watchpoint should suspend on access to its associated field. Opens the create exception breakpoint dialog. Opens the breakpoints properties dialog. Availability Context menu View action Context menu
Changes if the selected exception breakpoint Context menu should suspend when the specified type of exception is caught. Collapses all of the items in the view. Copies the selected breakpoints to the system clipboard. Changes the selected breakpoint(s) to be disabled. Changes the selected breakpoint(s) to be enabled. Changes if the selected method breakpoint should suspend on entry to the associated method. Changes if the selected method breakpoint should suspend on exit from the associated method. Expands all of the items in the view. Opens the export breakpoints wizard. View action Context menu Context menu Context menu Context menu
Exit
Context menu
Breakpoints View Commands Command Name Go to File Group By... Hit Count Import Breakpoints... Link with View Modification Description Opens the corresponding location of the breakpoint in the java editor. Allows you to select an alternate grouping for your breakpoints or create your own. Availability Context menu and view action View action
Allows you to set or change the hit count for Context menu the selected breakpoint. Opens the import breakpoints wizard. Changes if the breakpoints should be linked to the Debug View. Changes if the selected watchpoint should suspend when its associated field is modified. Pastes copied breakpoints into the view. Removes all breakpoints from the view. Removes only the selected breakpoint(s) from the view. Selects all of the breakpoints in the view. Allows you to choose which working set will be the default one. Changes if qualified names are shown or not. Changes if only supported breakpoints should be shown or not. Sets all breakpoints to be skipped. Context menu View action Context menu
Paste Remove All Remove Selected Breakpoints Select All Select Default Working Set Show Qualified Names Show Supported Breakpoints Skip All Suspend Uncaught
Context menu Context menu and view action Context menu and view action Context menu View action View action View action View action
Allows you to choose what to suspend when Context menu the selected breakpoint is hit. Changes if the selected exception breakpoint Context menu should suspend when the specified type of exception is not caught. Opens the working sets dialog. View action
Working Sets...
Adding breakpoints Applying hit counts Catching Java exceptions Removing breakpoints Enabling and disabling breakpoints Managing conditional breakpoints Setting method breakpoints
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Watchpoint Access
Select the Access command to change if the currently selected watchpoint will suspend when its associated field is accessed or read.
Breakpoints
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
In the Choose an Exception field, type a string that is contained in the name of the exception you want to add. You can use wildcards as needed ("* " for any string and "? " for any character). In the Matching types list , select the exception you want to add. Select Caught and Uncaught as needed to indicate on which exception type you want to suspend the program.
Breakpoints
Catching Java exceptions Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Breakpoints View Run Menu Caught Exception Option Uncaught Exception Option
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoint Properties...
Select the Breakpoint Properties... command to open the breakpoint properties dialog for the currently selected breakpoint.
There are separate properties for each type of breakpoint, thus resulting in varying properties dialogs. The example given below is for a line breakpoint.
Adding breakpoints Applying hit counts Catching Java exceptions Removing breakpoints Enabling and disabling breakpoints Managing conditional breakpoints Setting method breakpoints
Breakpoints View Condition option Enabled option Hit count option Exception breakpoint caught option Exception breakpoint suspend on subclass option Exception breakpoint uncaught option Method breakpoint entry option Method breakpoint exit option Suspend Policy Watchpoint access option Watchpoint modification option
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoints
Adding breakpoints Catching Java exceptions Removing breakpoints Launching a Java program Running and debugging
-----------------------------------------------------------------------------
-----------------------------------------------------------Java development user guide > Reference > Views > Variables View
Collapse All
Select the Collapse All command [ This command applies to:
-----------------Java development user guide > Reference > Views > Variables View
Copy
Select the Copy command [ ] to copy the selected contents from the view onto the system clipboard. You can also use the standard keyboard shortcut Ctrl+C. This command applies to:
Breakpoints View Console View Debug View Display View Expressions View Registers View Variables View Detail Pane (in the Expressions View and Variables View)
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Disable Breakpoints
Select the Disable command [ ] to disable the currently selected breakpoint(s).
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Enable Breakpoints
Select the Enable command [ ] to enable the currently selected breakpoint(s).
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Expand All
Select the Expand All command [ ] to expand all of the items in the Breakpoints View.
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Breakpoints View
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Export Breakpoints
Select the Export Breakpoints... command [ will help you export breakpoints to a file. ] to start the Export Breakpoints wizard which
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Breakpoints View Export Breakpoints wizard Import Breakpoints wizard Import Breakpoints command
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Breakpoints View
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Group Breakpoints By
Select the Group By view menu item to group the breakpoints in the Breakpoints View in one of a choice of predefined orderings.
Breakpoints - a standard list of all breakpoints Breakpoint Types - all breakpoints organized into their respective types Breakpoint Working Sets - all breakpoints are organized into the working sets they belong to Files - all breakpoints are organized by the files that they belong to Projects - all breakpoints are organized by the project that they belong to Resource Working Sets - all breakpoints are organized by the resource working sets that they belong to Advanced...- See below.
The Advanced... command opens a dialog that allows you to specify multiple levels of groupings for your breakpoints. For example you could have breakpoint grouped by type, which are then further grouped by resource working set, which are then further grouped by projects.
Breakpoints
Adding breakpoints Create a breakpoint working set Removing breakpoints Launching a Java program Running and debugging
Breakpoints View
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Import Breakpoints
Select the Import Breakpoints... command [ ] to start the will help you import breakpoints into your workspace. Import Breakpoints wizard which
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Breakpoints View
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Watchpoint Modification
Select the Modification command to change if the currently selected watchpoint will suspend when its associated field is modified or written to.
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
----------------------------------------------------------------------------Java development user guide > Reference > Views > Variables View > Detail Pane
Paste
Select the Paste command [ ] to copy material from the system clipboard into the current view. You can also use the standard keyboard shortcut Ctrl+V. This command applies to:
Breakpoints View
Console View Display View Detail Pane (in the Expressions View and Variables View)
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Breakpoints View
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoints
Breakpoints View
----------------------------------------------------------------------------Java development user guide > Reference > Views > Variables View
Select All
Choose this command to select all of the content in the view. You can also use the standard keyboard shortcut Ctrl+A. This command applies to:
Breakpoints View Console View Display View Expressions View Registers View Variables View Detail Pane (in the Expressions View and Variables View)
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoints
Adding breakpoints Create Working set Removing breakpoints Launching a Java program Running and debugging
Breakpoints View
----------------------------------------------------------------------------Java development user guide > Reference > Views > Variables View > View Display Commands
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Breakpoints View
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
Breakpoints View
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoint Suspend
Select the Suspend command [ ] to change the suspend policy of a breakpoint between suspending the entire VM and the thread in which the breakpoint suspended. There is only one menu item visible at any one given time, showing you which suspend policy you will be changing to should you select it. You can change the default suspend policy for all newly created breakpoints on the Debug preference page. Java >
Breakpoints
Adding breakpoints Removing breakpoints Launching a Java program Running and debugging
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoints
Adding breakpoints Create Working set Removing breakpoints Launching a Java program Running and debugging
Breakpoints View
----------------------------------------------------------------------------Java development user guide > Reference > Views > Breakpoints View
Breakpoints
Console View
The Console View displays a variety of console types depending on the type of development and the current set of user settings.
The three consoles that are provided by default with the Eclipse Platform are:
The Process Console The Stacktrace Console The CVS Console Run/Debug > Console preference page.
The commands available in the Console View are listed below. Console View Commands Command Name Clear Console Description Clears the currently active console, and is available as both a view command and a contextual menu item. Opens a listing of current consoles and allows you to select which one you would like to see. Opens a new console of the selected type. Availability Context menu and view action View action
View action
Pins the current console to remain on top of all View action other consoles. Changes if scroll lock should be enabled or not Context menu and
Console View Commands Command Name Description in the current console. Availability view action
Console Preferences CVS Console Process Console Stacktrace Console Views and editors
----------------------------------------------------------------------------Java development user guide > Reference > Views > Console View
CVS Console
The CVS Console displays the output from current and recent CVS operations.
The extra commands available in the CVS Console are listed below.
CVS Console Commands Command Copy Cut Find/Replace Open Link Name Description Copies the selected material from the console onto the system clipboard. Availability Context menu
Copies the selected material to the system Context menu clipboard and removes it from the console. Allows you to search for and replace a specified expression. Allows you to follow the hyperlink which was right-clicked on in the current stacktrace. Pastes material saved on the system clipboard into the current console. Selects all of the contents of the current console. Context menu Context menu
----------------------------------------------------------------------------Java development user guide > Reference > Views > Variables View
Copy
Select the Copy command [ ] to copy the selected contents from the view onto the system clipboard. You can also use the standard keyboard shortcut Ctrl+C. This command applies to:
Expressions View Registers View Variables View Detail Pane (in the Expressions View and Variables View)
----------------------------------------------------------------------------Java development user guide > Reference > Views > Variables View > Detail Pane
Cut
Select the Cut command [ ] to copy the selected contents from the view to the system clipboard and remove the selection from the view. You can also use the standard keyboard shortcut Ctrl+X. This command applies to:
Console View Display View Detail Pane (in the Expressions View and Variables View)
----------------------------------------------------------------------------Java development user guide > Reference > Views > Variables View > Detail Pane
Find/Replace
Select the Find/Replace command to search for and replace specific statements or portions of statements. You can also use the keyboard shortcut Ctrl+F. The resulting find/replace dialog.
Console View Display View Detail Pane (in the Expressions View and Variables View)
----------------------------------------------------------------------------Java development user guide > Reference > Views > Console View > Stacktrace Console
Open Link
Select the Open Link command to follow a detected hyperlink in the Stacktrace Console or the CVS Console.
----------------------------------------------------------------------------Java development user guide > Reference > Views > Variables View > Detail Pane
Paste
Select the Paste command [ ] to copy material from the system clipboard into the current view. You can also use the standard keyboard shortcut Ctrl+V. This command applies to:
Breakpoints View Console View Display View Detail Pane (in the Expressions View and Variables View)
----------------------------------------------------------------------------Java development user guide > Reference > Views > Variables View
Select All
Choose this command to select all of the content in the view. You can also use the standard keyboard shortcut Ctrl+A. This command applies to:
Breakpoints View Console View Display View Expressions View Registers View Variables View Detail Pane (in the Expressions View and Variables View)
----------------------------------------------------------------------------Java development user guide > Reference > Views > Console View
Process Console
The Process Console shows the output of a process and allows you to provide keyboard input to a process.
You can choose the different colors for these kinds of text on the preference page.
The extra commands available in the Process Console are listed below. Process Console Commands Command Copy Cut Name Description Copies the selected material from the console onto the system clipboard. Copies the selected material to the system clipboard and removes it from the console. Allows you to search for and replace s specified expression. Pastes material saved on the system clipboard into the current console. Availability Context menu Context menu
Opens the Console Preference Page, Context menu allowing you to customize you consoles. Removes all of the terminated launches from the current console. Removes the current launch from the Context menu and view action View action
Process Console Commands Command Copy Cut Name Description Copies the selected material from the console onto the system clipboard. Copies the selected material to the system clipboard and removes it from the console. Allows you to search for and replace s specified expression. Pastes material saved on the system clipboard into the current console. console. Terminate Select All Terminates the running launch in the current console. Selects all of the contents of the current console. View action Context menu Availability Context menu Context menu
Find/Replace Paste
Show Console When Will open (if needed) and bring a View Action Standard Out Changes console to the front when information is written to the System.out stream Show Console When Standard Error Changes Will open (if needed) and bring a View Action console to the front when information is written to the System.err stream
----------------------------------------------------------------------------Java development user guide > Reference > Views > Variables View
Copy
Select the Copy command [ ] to copy the selected contents from the view onto the system clipboard. You can also use the standard keyboard shortcut Ctrl+C. This command applies to:
Breakpoints View Console View Debug View Display View Expressions View Registers View Variables View Detail Pane (in the Expressions View and Variables View)
Java development user guide > Reference > Views > Variables View > Detail Pane
Cut
Select the Cut command [ ] to copy the selected contents from the view to the system clipboard and remove the selection from the view. You can also use the standard keyboard shortcut Ctrl+X. This command applies to:
Console View Display View Detail Pane (in the Expressions View and Variables View)
Java development user guide > Reference > Views > Console View > Process Console
Console Preferences
Select the Preferences... command to open the Run/Debug > Console preference page. This command only applies to the Process Console.
Console View CVS Console Process Console Stacktrace Console Java development user guide > Reference > Views > Variables View > Detail Pane
Find/Replace
Select the Find/Replace command to search for and replace specific statements or portions of statements. You can also use the keyboard shortcut Ctrl+F. The resulting find/replace dialog.
Console View Display View Detail Pane (in the Expressions View and Variables View)
Java development user guide > Reference > Views > Variables View > Detail Pane
Paste
Select the Paste command [ ] to copy material from the system clipboard into the current view. You can also use the standard keyboard shortcut Ctrl+V. This command applies to:
Breakpoints View Console View Display View Detail Pane (in the Expressions View and Variables View)
Java development user guide > Reference > Views > Console View > Process Console
Console View CVS Console Process Console Stacktrace Console Java development user guide > Reference > Views > Console View > Process Console
Remove Launch
Select the Remove Launch command [ Console. ] to remove the current launch from the Process
Console View CVS Console Process Console Stacktrace Console Java development user guide > Reference > Views > Variables View
Select All
Choose this command to select all of the content in the view. You can also use the standard keyboard shortcut Ctrl+A. This command applies to:
Breakpoints View Console View Display View Expressions View Registers View Variables View Detail Pane (in the Expressions View and Variables View)
Java development user guide > Reference > Views > Console View > Process Console
Java development user guide > Reference > Views > Console View > Process Console
Console View CVS Console Process Console Stacktrace Console Java development user guide > Reference > Views > Console View > Process Console
Terminate
Select the Terminate command [ Process Console. ] to terminate the process that is associated with the current
-----------------------------------------------------------------------------
Java development user guide > Reference > Views > Console View
Stacktrace Console
The Stacktrace Console displays a Java stacktrace in a nicely formatted manner, providing hyperlink support to quickly jump to source code locations.
The extra commands available in the Stacktrace Console are listed below. Stacktrace Console Commands Command Name Auto Format Copy Cut Find/Replace Format Description Automatically formats stacktraces when pasted into a stacktrace console Copies the selected material from the console onto the system clipboard. Copies the selected material to the system clipboard and removes it from the console. Allows you to search for and replace s specified expression. Reformats the current stacktrace. This command in only available to stacktrace consoles. Allows you to follow the hyperlink which was right-clicked on in the current stacktrace. Pastes material saved on the system clipboard into the current console. Selects all of the contents of the current console. Availability View Action Context menu Context menu Context menu Context menu
Open Link
Context menu
----------------------------------------------------------------------------Java development user guide > Reference > Views > Console View > Stacktrace Console
Console Autoformat
Select the Autoformat command [ ] to automatically reformat any stacktrace pasted into the Stacktrace Console. This command is only available to stacktrace consoles.
Console View CVS Console Process Console Java development user guide > Reference > Views > Variables View
Copy
Select the Copy command [ ] to copy the selected contents from the view onto the system clipboard. You can also use the standard keyboard shortcut Ctrl+C. This command applies to:
Breakpoints View Console View Debug View Display View Expressions View Registers View Variables View
Java development user guide > Reference > Views > Variables View
Copy
Select the Copy command [ ] to copy the selected contents from the view onto the system clipboard. You can also use the standard keyboard shortcut Ctrl+C. This command applies to:
Breakpoints View Console View Debug View Display View Expressions View Registers View Variables View Detail Pane (in the Expressions View and Variables View)
----------------------------------------------------------------------------Java development user guide > Reference > Views > Variables View > Detail Pane
Cut
Select the Cut command [ ] to copy the selected contents from the view to the system clipboard and remove the selection from the view. You can also use the standard keyboard shortcut Ctrl+X. This command applies to:
Console View Display View Detail Pane (in the Expressions View and Variables View)
Java development user guide > Reference > Views > Variables View > Detail Pane
Find/Replace
Select the Find/Replace command to search for and replace specific statements or portions of statements. You can also use the keyboard shortcut Ctrl+F. The resulting find/replace dialog.
Console View Display View Detail Pane (in the Expressions View and Variables View)
Java development user guide > Reference > Views > Console View > Stacktrace Console
Console Format
Select the Format command to reformat the current stacktrace in the Stacktrace Console. You can also use the keyboard shortcut Ctrl+Shift+F. This command is only available to stacktrace consoles.
Console View CVS Console Process Console Java development user guide > Reference > Views > Console View > Stacktrace Console
Open Link
Select the Open Link command to follow a detected hyperlink in the Stacktrace Console or the CVS Console.
Console View CVS Console Process Console Stacktrace Console Java development user guide > Reference > Views > Variables View > Detail Pane
Paste
Select the Paste command [ ] to copy material from the system clipboard into the current view. You can also use the standard keyboard shortcut Ctrl+V. This command applies to:
Breakpoints View Console View Display View Detail Pane (in the Expressions View and Variables View)
Java development user guide > Reference > Views > Variables View
Select All
Choose this command to select all of the content in the view. You can also use the standard keyboard shortcut Ctrl+A. This command applies to:
Breakpoints View Console View Display View Expressions View Registers View Variables View Detail Pane (in the Expressions View and Variables View)
Java development user guide > Reference > Views > Console View
Clear Console
Select the Clear Console command [ ] to clear all of the contents in the Console View .
Java development user guide > Reference > Views > Console View
Console View CVS Console Process Console Stacktrace Console Java development user guide > Reference > Views > Console View
Open Console
Select the Open Console command [ View . ] to open a new specific type of console in the Console The resulting menu from selecting the drop down arrow on the command.
Console View CVS Console Process Console Stacktrace Console Java development user guide > Reference > Views > Console View
Pin Console
Select the Pin Console command [ consoles. ] to ensure that the current console remains on top of all other For example if you had two consoles, say a Process Console and a Stacktrace Console, and you had the stacktrace console pinned, even if output is written to the process console it will not come to focus in front of the stacktrace console.
Console View CVS Console Process Console Stacktrace Console Java development user guide > Reference > Views > Console View
Scroll Lock
Select the Scroll Lock command [ for all open consoles. ] to change whether scroll lock should be enabled or disabled
Console View CVS Console Process Console Stacktrace Console stignav do : java-tasks-reference-views-debug view -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------v