Quick Reference

This section lists common tasks for application development, keyboard shortcuts for use in the IDE, and abbreviations for coding in the Source Editor. You can see a complete list of keyboard shortcuts by choosing Menu > Keyboard Shortcuts from the main menu.

You can also modify and assign keyboard shortcuts for IDE actions in the Options window. To view or change shortcuts for IDE actions, open the Options window and choose Keymap in the left pane. In the right pane, select the action and enter or change the keyboard shortcut in the Shortcuts text area.

This section covers:

 

Window Navigation Shortcuts

Keys

Action

Ctrl-0

Switches focus to the Source Editor.

Ctrl-1/Ctrl-Shift-1

Switches focus to the Projects window.

Ctrl-2/Ctrl-Shift-2

Switches focus to the Files window.

Ctrl-3/Ctrl-Shift-3

Switches focus to the Favorites window.

Ctrl-4

Switches focus to the Output window.

Ctrl-5

Switches focus to the Runtime window.

Ctrl-6

Switches focus to the To Do window.

Ctrl-7

Switches focus to the Navigator window.

Ctrl-8/Ctrl-Shift-8

Opens the Versioning window.

Alt-Shift-1

Opens the Local Variables debugger window.

Alt-Shift-2

Opens the Watches debugger window.

Alt-Shift-3

Opens the Call Stack debugger window.

Alt-Shift-4

Opens the Classes debugger window.

Alt-Shift-5

Opens the Breakpoints debugger window.

Alt-Shift-6

Opens the Sessions debugger window.

Alt-Shift-7

Opens the Threads debugger window.

Alt-Shift-8

Opens the Sources window.

Ctrl-Tab

Toggles through the open windows in the order that they were last used. The dialog box displays all open windows and each of the open documents in the Source Editor.

Shift-Escape

Maximizes the Source Editor or the present window.

Ctrl-F4

Closes the current tab in the current window. If the window has no tabs, the whole window is closed.

Ctrl-Shift-F4

Closes all open documents in the Source Editor.

Shift-F4

Opens the Documents dialog box, in which you can save and close groups of open documents.

Alt-right

Displays the next tab in the current window.

Alt-left

Displays the previous tab in the current window..

Project Tasks

To perform this task

Follow these steps

Create a project.

  1. Choose File > New Project (Ctrl-Shift-N).
  2. Select the right template for your project.

Add a JAR file to a standard project's classpath.

  1. In the Projects window, right-click the node for the project and choose Properties.
  2. In the Project Properties dialog box, select the Libraries node in the Categories pane and ensure the Compile tab is selected.
  3. Click Add JAR and select the JAR file in the file chooser.

Note: If you also want to attach source code and Javadoc for the JAR file, click Add Library instead.

Set up compilation dependencies between projects.

  1. In the Projects window, right-click the node for the project and choose Properties.
  2. In the Project Properties dialog box, select the Libraries node in the Categories pane and ensure the Compile tab is selected.
  3. Click Add Project and select the project folder for the project that you want to add to the classpath.

Open required projects.

  • In the Projects window, right-click the project node and choose Open Required Projects.

Build a project.

  • Choose Build > Build Main Project (F11) or right-click any project node and choose Build Project.

Clean a project.

  • Right-click the project node and choose Clean Project.

Clean and build a project.

  • Right-click the project node and choose Clean and Build Main Project (Shift-F11).

Run a project.

  • Choose Run > Run Main Project (F6) or right-click any project node and choose Run Project.

Stop a running project.

  • Choose Build > Stop Build/Run.

Debug a project.

  • Choose Run > Debug Main Project (F5) or right-click any project and choose Debug Project.

Specify sources for a JAR file on the project classpath.

  1. Choose Tools > Library Manager from the main window.
  2. If the JAR file is not already registered in the Library Manager, create a new empty library using the Add Library button.
  3. Select the library in the left panel of the Library Manager.
  4. In the Classpath tab, click Add JAR/Folder and specify the location of the JAR file containing the compiled class files. Note: A library can contain multiple JAR files.
  5. In the Sources tab, add the folder or archive file containing the source code.

Specify Javadoc for a JAR file on the project classpath.

  1. Choose Tools > Library Manager from the main window.
  2. If the JAR file is not already registered in the Library Manager, register the JAR file as described above.
  3. In the Javadoc tab, click Add ZIP/Folder and specify the location of the Javadoc files.

Set the main project.

  • Right-click the project node and choose Set Main Project.

CVS Tasks

To perform this task

Follow these steps

Check out sources.

  1. Select CVS > Checkout from the main menu.
  2. In the CVS dialog box, specify the CVS repository root location and password and click Next.
  3. Specify the modules you wish to check out.
    You can checkout specific modules and branches by clicking the Select button and choosing from options available.
  4. Specify the location of the local folder.
  5. Click Finish to check out the files.

Update local file versions.

  1. In the Project, Files or Favorites window, right-click the file's node that you wish to update and choose CVS > Update.

Diff files.

  1. In the Project, Files or Favorites window, right-click the appropriate revision node and choose CVS > Diff.

Commit local changes.

  1. Ensure that your local copies of the files are up to date by right-clicking and choosing CVS > Update before proceeding.
  2. Right-click the files or directories you wish to commit and choose CVS > Commit.

Merge revisions.

  1. In the Project, Files or Favorites window, right-click the appropriate revision node and choose CVS > Merge Changes from Branch.
  2. In the Merge Changes from Branch dialog box, specify the options for the merge and click Merge.

Configure global VCS options.

  1. Choose Tools > Options and click the Advanced Options button in the Options window.
  2. Expand the Server and External Tool Settings node and then the Diff and Merge Types node in the left pane.
  3. Select the node to modify in the left pane and edit the desired properties in the right pane of the Options window.

Configuring Tasks

To perform this task

Follow these steps

Configure general options

  1. Choose Tools > Options from the main menu.
  2. In the left pane of the Options window, select a category in the left pane to display the settings options in the right pane.
  3. Specify the desired settings in the right pane of the Options window.

Set the IDE's web browser

  1. Choose Tools > Options from the main menu.
  2. Select the General category in the left pane of the Options window and select the desired browser from the Web Browser drop-down list.

Configure proxy settings

  1. Choose Tools > Options from the main menu.
  2. Select the General category in the left pane of the Options window and specify the proxy settings in right pane. To use a proxy server, select the HTTP Proxy check box and type the Proxy Host and Proxy Port.

Configure the Auto Update feature

  1. Choose Tools > Options from the main menu.
  2. In the Check Period drop-down list, choose how often you want the IDE to automatically check the Update Center for updates.

Configure Advanced IDE options

  1. Choose Tools > Options from the main menu.
  2. Click the Advanced Options button in the Options window to see the the Advanced view.
  3. Select a node in the left pane and set the properties as desired in the right pane.

Configure General Java Settings

  1. From the main menu, choose Tools > Options.
  2. In the Advanced Options view, expand the Editing node and select Java Sources in the left pane of the window.
  3. Set properties as desired in the right pane of the window.

Customize the IDE's Menus

  1. In the Advanced Options view, expand IDE Configuration > Look and Feel > Menu Bar.
  2. Right-click the Menu Bar node and choose Add > Menu.
  3. In the New Menu dialog box, type a name for the menu and click OK.
    The IDE adds an empty menu to the main window.
  4. Expand the Actions node and find the command you want to add to the menu, then right-click the command node and choose Copy.
  5. Expand the Menu Bar node, right-click the node of the menu you just created, and choose Paste > Copy.

Customize the toolbar in the IDE

  1. From the main window, choose View > Toolbars > Customize, or right-click the IDE toolbar and choose Customize.
  2. In the Customize Toolbars dialog box, click New Toolbar and name your toolbar.
  3. The IDE adds an empty toolbar to the main window. You can now drag an item from the Customize Toolbars dialog box to your new toolbar.

Install additional modules

  1. Choose Tools > Update Center from the main menu.
  2. Designate the update center location you want to connect to in the Update Center wizard and click Next.
  3. Select the modules you wish to install.
  4. Review the licensing agreement and click Accept.

Enable and disable modules

  1. Choose Tools > Module Manager from the main menu to open the Module Manager.
  2. Select or deselect the Active checkbox to activate or deactivate that module.
    You can check for new modules by clicking the Update button in the Module Manager to open the Update Center Wizard.

Source Editor Tasks

To perform this task

Follow these steps

Open a file that is not available in the Projects window or the Files window.

  1. Choose File > Open File (Ctrl-O).
  2. In the file chooser, navigate to the file and then click Open.

Maximize a tab in the Source Editor.

Do one of the following:

  • Double-click a file's tab in the Source Editor.
  • Make sure that the Source Editor window has focus and then press Shift-Escape.
  • Choose Window > Maximize.

Revert a maximized Source Editor to its previous size.

Do one of the following:

  • Double-click a file's tab in the Source Editor.
  • Press Shift-Escape.
  • Choose Window > Restore.

Display line numbers.

Choose View > Show Line Numbers.

View two files simultaneously.

  1. Open two or more files.
  2. Click the tab of one of the files and drag it to the side of the window where you want the file to be placed. Once the red preview box appears indicating the correct location for the window, release the mouse button to drop the window.

The window can be split horizontally or vertically, depending on where you drag the tab.

Split the view of a single file.

  1. Right-click the document's tab in the Source Editor and choose Clone Document.
  2. Click the tab of the cloned document and drag it to the part of the window where you want the copy to be placed.

Format code automatically.

  • Right-click in the Source Editor and choose Reformat Code.

If any text is selected, only that text will be reformatted. If no text is selected, then the whole file is reformatted.

Source Editor Abbreviations for Java Files

Abbreviation

Expansion

ab

abstract

bo

boolean

br

break

ca

catch {

cl

class

cn

continue

df

default;

dowhile

do {

${cursor}

} while (${condition});

En

Enumeration

eq

equals

Ex

Exception

ex

extends

fa

false

fi

final

fl

float

forc

for (Iterator it = collection.iterator(); it.hasNext();) {

Object elem = (Object) it.next();

 

}

fore

for (Iterator it = collection.iterator(); it.hasNext();) {

Object elem = (Object) it.next();

 

}

fori

for (int i = 0; i < ${arr array}.length; i++) {

${cursor}

}

fy

finally

ie

interface

if

if (${condition}) {

${cursor}

} else {

 

}

im

implements

iof

instanceof

ir

import

le

length

newo

Object name = new Object(args);

Ob

Object

pe

protected

pr

private

psf (or Psf )

private static final

psfb (or Psfb )

private static final boolean

psfi (or Psfi )

private static final int

psfs (or Psfs )

private static final String

pst

printStackTrace();

psvm

public static void main(String[] args) {

${cursor}

}

pu

public

re

return

serr

System.err.println ("

sout

System.out.println ("

St

String

st

static

sw

switch (

sy

synchronized

tds

Thread.dumpStack();

th

throws

trycatch

try {

${cursor}

} catch (Exception e) {

 

}

tw

throw

twn

throw new

wh

While (

whilei

while (it.hasNext()) {

Object elem = (Object) it.next();

${cursor}

}

 

Source Editor Abbreviations for JSP and Servlet Files

Abbreviation

Expansion

ag

application.getValue("

ap

application.putValue("

ar

application.removeValue("

cfgi

config.getInitParameter("

jg

<jsp:getProperty name="

jspf

<jsp:forward page="

jspg

<jsp:getProperty name="

jspi

<jsp:include page="

jspp

<jsp:plugin type="

jsps

<jsp:setProperty name="

jspu

<jsp:useBean id="

oup

out.print("

oupl

out.println("

pcg

pageContext.getAttribute("

pcgn

pageContext.getAttributeNamesInScope("

pcgs

pageContext.getAttributesScope("

pcr

pageContext.removeAttribute("

pcs

pageContext.setAttribute("

pg

<%@ page

pga

<%@ page autoFlush="

pgb

<%@ page buffer="

pgc

<%@ page contentType="

pgerr

<%@ page errorPage="

pgex

<%@ page extends="

pgie

<%@ page isErrorPage="

pgim

<%@ page import="

pgin

<%@ page info="

pgit

<%@ page isThreadSafe="

pgl

<%@ page language="

pgs

<%@ page session="

rg

<request.getParameter("

sg

session.getValue("

sp

session.putValue("

sr

session.removeValue("

tglb

<%@ taglib uri="

Source Editor Abbreviations for XML and DTD Files

Abbreviation

Expansion

?xm

<?xml version="1.0" encoding="UTF-8"?>

!do

<!DOCTYPE>

!cd

<![CDATA[|]]>

!at

<!ATTLIST |>

!el

<!ELEMENT |>

!en

<!ENTITY |>

pu

PUBLIC "|"

sy

SYSTEM "|"

!at

<!ATTLIST |>

!el

<!ELEMENT |>

!en

<!ENTITY |>

!no

<!NOTATION |>

pu

PUBLIC "|"

sy

SYSTEM "|"

cd

CDATA

em

EMPTY

en

ENTITY

ens

ENTITIES

fi

#FIXED

im

#IMPLIED

nm

NMTOKEN

nms

NMTOKENS

nn

NOTATION

pc

#PCDATA

Special Code Template Syntax

Code Template Syntax Construct

Explanation

${cursor}

Indicates where the insertion point should go after the code snippet has been added to your code.

${Identifier}

Indicates an identifer that needs to be filled in when you use the code template. When you use this construct in a template definition, replace Identifier with the identifer name that you want to appear in the template.

index

An attribute that you can use within a ${Identifier} segment to designate that an unused variable name should be generated in the code snippet. For example, you could use ${ind index} .

type="FullyQualifiedType" editable="false"

An attribute that you can use within a ${Identifier} segment to generate a class name. When you use the code template, an import statement for the class is also inserted into your code. For example, you could use ${cce itype="java.lang.ClassCastException" editable="false"} to have ClassCastException inserted into your code and make sure that the import statement is generated, if necessary. Specifying editable="false" ensures that ClassCastException is not selected for editing once the template is inserted into your code.

instanceof="FullyQualifiedType"

An attribute that you can use within a ${Identifier} segment to designate the type that the identifier must represent an instance of. For example, you could use ${collection instanceof="java.util.Collection"} where collection is the default identifier in the template and java.util.Collection is the class of which the identifier must represent an instance.

Build Tasks

To perform this task

Follow these steps

Add a JAR file to a project's classpath.

  1. In the Projects window, right-click the node for the project and choose Properties.
  2. In the Project Properties dialog box, select the Libraries node in the Categories pane and ensure the Compile tab is selected.
  3. Click Add JAR and select the JAR file in the file chooser.
    Note: If you also want to attach source code and Javadoc for the JAR file, click Add Library instead.

Add an IDE project to a project's classpath.

  1. In the Projects window, right-click the node for the project and choose Properties.
  2. In the Project Properties dialog box, select the Libraries node in the Categories pane and ensure the Compile tab is selected.
  3. Click Add Project and select the project folder for the project that you want to add to the classpath.

Build a project.

  • Choose Build > Build Main Project (F11) or right-click any project in the Projects window and choose Build Project.

Compile a single file.

  • Choose Build > Compile File (F9).

Clean a project.

  • In the Projects window, right-click the project node and choose Clean Project.

Clean and build the main project.

  • Choose Build > Clean and Build Main Project (Shift-F11).

View build products, such as JAR files and generated Javadoc.

  1. In the Files window, expand the project folder node.
  2. Open the build folder to view the project's compiled classes.
    Note: Javadoc files and built libraries, like JAR files and WAR files, are in the dist folder.

Correct compilation errors.

  • In the Output window, double-click any Java syntax error to jump to the location in the source code where the error occurred.
  • In the Output window, double-click any Ant error to open the Ant script in the target that failed.

Running J2SE Application Tasks

To perform this task

Follow these steps

Set the runtime classpath.

  1. Right-click the project node in the Projects window and choose Properties.
  2. Select the Libraries node in the Categories pane.
  3. Use the Add Project, Add Library, or Add JAR/Folder buttons to add the required file type to the project's classpath.
    Note: By default, the project's runtime classpath contains the project's compiled sources and everything on the compilation classpath.

Set the project main class

  1. Right-click the project node in the Projects window and choose Properties.
  2. Select the Run node in the Categories pane.
  3. Type the fully qualified name of the class in the Main Class field.

Set the runtime arguments.

  1. Right-click the project node in the Projects window and choose Properties.
  2. Select the Run node in the Categories pane.
  3. Enter the arguments in the Arguments field.

Set JVM arguments.

  1. Right-click the project node in the Projects window and choose Properties.
  2. Select the Run node in the Categories pane.
  3. Type a space-separated list of arguments in the VM Arguments field.

Set the working directory for execution.

  1. Right-click the project node in the Projects window and choose Properties.
  2. Select the Run node in the Categories pane.
  3. Type the full path to the working directory in the Working Directory field.

Run a project.

  • Choose Run > Run Main Project (F6).
  • Right-click any project in the Projects window and choose Run Project.

Run a single file.

  1. Select one or more files in the Projects window, Files window, or Source Editor.
  2. Choose Run > Run File > Run your_filename from the main menu.

Running Web Application Tasks

To perform this task

Follow these steps

Set request parameters for JSP files.

  1. In the Projects or Files window, navigate to the project's JSP file.
  2. Right-click the JSP file and choose Properties.
  3. Type the necessary parameters in the Request Parameters property field in the URL_query_string format.

 

Set execution URIs and parameters for servlets.

  1. Select the servlet in the Projects or Files window.
  2. Choose Tools > Set Servlet Execution URI in the main menu.
  3. Type the execution URI and parameters.
  4. Click OK.

Note that you can only set a request URI for a servlet if it has servlet mappings in the deployment descriptor ( web.xml file). The default URI is defined in the deployment descriptor.

Set the runtime classpath.

In the Projects window, right-click the Libraries node and choose Add Project, Add Library, or Add JAR/Folder, to add the necessary item to the project's classpath.

Note that by default, the project's runtime classpath contains the project's compiled sources and everything on the compilation classpath.

Set the web server.

  1. In the Projects window, right-click the project node and choose Properties.
  2. Select the Run node in the Categories pane.
  3. Select the web server from the Server drop-down.

Set the context path and relative URL.

  1. In the Projects window, right-click the project node and choose Properties.
  2. Select the Run node in the Categories pane.
  3. Type the desired path in the Context Path field and, optionally, a relative URL.

Run a project.

  • Choose Run > Run Main Project (F6)
  • Right-click any web project in the Projects window and choose Run Project.

Run a single file.

  1. Select one or more files in the Projects window, Files window, or Source Editor.
  2. Choose Run > Run File > Run your_filename from the main menu.

Debugging Tasks

To perform this task

Follow these steps

Start a local debugging session.

  • To debug the main project, choose Run > Debug Main Project (F5).
  • To debug any individual project, right-click the project and choose Debug Project.

Start a remote debugging session.

  1. On the computer where program is located, start the program in debugging mode.
  2. On the computer where the IDE is running, open the projects that contain the source for the program.
  3. Choose Run > Attach Debugger.
  4. Select the connector type, enter any required process information, and then click OK.
    Note: See your VM documentation for information about the connectors it provides.

Debug a single file.

  • Select any runnable file in the Projects window and choose Run > Run File > Debug your_filename .

Finish a debugging session.

  • To finish the current session, choose Run > Finish Debugger Session (Shift-F5).
  • To finish any session, open the Sessions window (Alt-Shift-6), right-click the session, and choose Finish.

Set a breakpoint.

  • To set a line breakpoint, open the file in the Source Editor and click in the left margin on the desired line (Ctrl-F8).
  • In the Source Editor, select the element of code on which you want to set a breakpoint and choose Run > New Breakpoint (Ctrl-Shift-F8). Then set the breakpoint type and additional options in the New Breakpoint dialog box.

Modify breakpoint properties.

  • Open the Sessions window (Alt-Shift-6), right-click the session, and choose Customize.

Set a watch.

  • Right-click a variable or expression in the Source Editor and choose New Watch (Ctrl-Shift-F7).

Suspend and resume a thread.

  • Open the Threads window (Alt-Shift-7), right-click the thread, and choose Suspend or Resume.

Manage which JDK classes the debugger steps into.

  • Open the Sources window (Alt-Shift-8) and select the checkbox for the archive file or directory containing the JDK sources.
  • Open the Sources window (Alt-Shift-8) and uncheck the checkbox for the source directories you do not want to step into.

Pop a call from the call stack.

  • To pop the most recent call from the call stack, choose Run > Stack > Pop Topmost Call.
  • To pop multiple calls, open the Call Stack window (Alt-Shift-3), right-click the call that you want to remain at the top of the call stack, and choose Pop to Here.

View information for a call on the call stack.

  • To move one level away from the main routine, choose Run > Stack > Make Callee Current (Ctrl-Alt-up arrow).
  • To move one level toward the main routine, choose Run > Stack > Make Caller Current (Ctrl-Alt-down arrow).
  • To make a call current, double-click the call in the Call Stack window.

JUnit Tasks

To perform this task

Follow these steps

Create a test for existing sources.

  1. Right-click the class or package node for which you wish to generate a test and choose Tools > JUnit Tests > Create Tests (Ctrl-Alt-J).
  2. Set the parameters for the test skeleton generator in the Create Tests dialog box and click OK.

Create an empty test.

  1. Choose File > New File.
  2. Select JUnit in the Categories pane and Empty Test in the File Types pane. Click Next.
  3. Enter a name for the test class in the Class Name field.
  4. Select the target package from the Package combo box and set any required options.
  5. Click Finish.

Run a test for a class.

  1. Select the node of the class you wish to test.
  2. From the Main menu, choose Run > Run File > Test filename (Ctrl-F6).

Run tests for an entire project.

  • Right-click the node of the project for which you wish to run tests and choose Test Project (Alt-F6).

Edit a test.

  1. Right-click the node for the source whose test you wish to edit.
  2. Choose Tools > JUnit Tests > Open Test (Ctrl-Alt-K) from the contextual menu.

Debug a test.

  1. Select the class for whose test you wish to debug.
  2. Choose Run > Run File > Debug Test for filename (Ctrl-Shift-F6).

Configure JUnit.

  1. Choose Tools > Options.
  2. Expand the Testing node and select JUnit Module Settings.
  3. Edit the necessary properties and then click Close.

Previous - TOC


Copyright and Trademark Notice