5 Working with Applications and Projects

This chapter describes how you can effectively work with applications and projects in the Oracle JDeveloper IDE.

This chapter includes the following sections:

5.1 About Working with Applications and Projects

The application is the highest level in the control structure. It is a view of all the objects you need while you are working. An application keeps track of all your projects while you develop programs.

A project is a logical container for a set of files that define a JDeveloper program or portion of a program. A project might contain files representing different tiers of a multi-tier application, for instance, or different subsystems of a complex application. These files can reside in any directory and still be contained within a single project.

You can remove application and project control files from the IDE without deleting them from the disk. (This is not true for other types of file, which will be deleted from the disk at the time that they are removed from the IDE.)

JDeveloper can recognize many different file types, displaying each in its appropriate viewer or editor when you double-click the file.

When adding a project to an application, you can choose to:

  • Create a new project, with specific objects and attributes you define.

  • Create a new empty project, which inherits default project properties.

  • Open an existing set of files from outside JDeveloper into a new project.

As soon as you create a new project or open an existing one, it is added to the application selected.

Projects control their files lists directly through the directory. Applications and packages also define where and how the files within a project are stored.

Note:

The same object (physical file) can appear in more than one project. This means that any actions carried out on the object in one project will show up in the other project (although some effects will become apparent only after the project is compiled). For packages, two or more projects should not share a package unless, first, they also share a source path used to generate the package and, secondly, the package is already compiled and will never be changed.

5.2 Creating Applications and Projects

New applications and projects are managed from the Application Navigator.

5.2.1 How to Create an Application

This section describes how to create a custom JDeveloper application and a project within it.

To create a new application:

  1. Open the New Gallery by choosing File > New.

  2. In the New Gallery, in the Categories tree, under General, select Applications.

  3. In the Items list, double-click the application type you want to create.

  4. In the Create Application dialog, enter application details like the name and directory. For help with the wizard, press F1.

  5. Click Next to open the Project Name page, where you can optionally provide details for your project.

  6. When you are done, click Finish.

5.2.2 How to Create a Custom Application

This section describes how to create a custom application that includes a single project that can be customized to include any features.

To create a custom application:

  1. Open the New Gallery by choosing File > New.

  2. In the New Gallery, in the Categories tree, under General, select Applications.

  3. In the Items list, double-click Custom Application. The Create Custom Application wizard opens.

  4. In the Create Custom Application dialog, enter application details like the name and directory. For help with the wizard, press F1.

  5. Click Next to open the Project Name page, where you can optionally provide details for your project.

  6. When you are done, click Finish.

5.2.3 How to Create a New Project

In JDeveloper, you use the Application Navigator to keep track of the projects (collections of related files or components) you use while developing your application. You can also create a new project based on existing source.

5.2.3.1 How to Create a New Project

You can create a new project from existing source or populated with new objects, or you can create a new empty project.

All projects inherit the settings specified in the Default Project Properties dialog. As soon as you create the project, it is added to the active application.

To create a new project from existing source or with new objects:

  1. In the Application Navigator, select the application within which the project will appear.

  2. Click the Application Menu icon, and select New Project to open the Projects page of the New Gallery.

  3. In the Items list, double-click the project type you want to create.

  4. Complete the Create Project wizard, and click Finish. For help on the wizard, press F1.

The new project appears in the navigator. It inherits whatever default properties you've already set. To alter project properties for this project, either double-click the filename or right-click and choose Project Properties.

5.2.3.2 How to Create a New Custom Project

A custom project can be customized to include any feature. All projects inherit the settings specified in the Default Project Properties dialog. As soon as you create the project, it is added to the active application.

To create a new custom project and add it to the active application:

  1. In the Application Navigator, open the application that will contain the new project.

  2. Click the Application Menu icon, and select New Project to open the Projects page of the New Gallery.

  3. Under Items, select Custom Project.

  4. Click OK.

5.3 Managing Applications and Projects

JDeveloper provides several features to effectively manage your applications and projects.

5.3.1 How to Open an Existing Application or Project

You can create new applications and projects from scratch or open existing ones. As soon as you create or import the application, it is added to the Applications node in the Application Navigator. As soon as you create or import a project, it is added to the selected application.

To open an existing application and add it to the Application Navigator:

  1. In the Application Navigator, select Open Application from the dropdown list.

  2. Navigate to the application file and select it.

    Be sure that the file type field either specifies .jws files or allows all types to be displayed.

  3. Click Open.

    The application is added to the list of applications in the navigator.

To open an existing project and add it to an application:

  1. In the Application Navigator, select the application to which the project will be added.

  2. From the main menu, choose File > Open.

  3. Navigate to the project file and select it.

    Be sure that the file type field either specifies .jpr files or allows all types to be displayed.

  4. Click Open.

    The project is added to the active application.

5.3.2 How to Import Existing Source Files into JDeveloper

You can create new files of various types from scratch or open existing ones. When opening existing files, you can import them, along with their file structure, into an existing project or build a completely new project around them.

Alternatively, you can add source files to projects you already have.

5.3.2.1 Importing Existing Files into a New JDeveloper Project

You can import existing files of any type into JDeveloper, creating a new project as you do so.

To open existing files and import them into a new JDeveloper project:

  1. In the Application Navigator, select or create the application to which the new project will be added.

  2. With the application selected choose File > New to open the New Gallery.

  3. In the Categories tree, expand General and select Projects.

  4. In the Items list, double-click Project from Existing Source.

  5. On the Location page of the Project from Existing Source wizard, enter a name for the new .jpr file or accept the default.

    For more information on this or subsequent wizard pages, press F1 or click Help from within the wizard.

    Alternatively, you can select File > Import, and choose either Java Source or Source into New Project.

  6. Accept the default directory path, enter a new path, or click Browse to navigate to one.

  7. Click Next.

  8. On the Specify Source page, in the Java Content area, click Add to open the Choose Directory dialog.

  9. In the dialog, navigate to the directory containing the files you wish to add. Click Select to close the dialog and display the directory in the wizard.

  10. When you have finished adding directories, you can apply file or directory filters. To apply filters, click Add next to the Included tab.

  11. When the import list is complete, optionally select Copy Files to Project directory to clone the selected files in your project rather than simply pointing to the original source.

  12. Define a default output directory and default package.

  13. Click Finish.

    The new project appears under the selected application node, populated with the imported files.

You can fine tune your project directories structure, for example to point to resource directories, in the Project Properties dialog.

5.3.2.2 How to Import a WAR File into a New JDeveloper Project

You can import a WAR file into JDeveloper, creating at the same time a new project to contain its extracted contents.

To open a WAR file and import it into a new JDeveloper project:

  1. In the Application Navigator, select or create the application to which the new project will be added.

  2. With the application selected choose File > New to open the New Gallery.

  3. In the Categories tree, expand General and select Projects.

  4. In the Items list, double-click Project from WAR File.

  5. Complete the Create Project from WAR File wizard.

    For information when using this wizard, press F1.

The wizard analyzes the WAR file and extracts its contents.

The new project appears under the selected application node, populated with the imported files.

5.3.2.3 Importing an EAR File into a New JDeveloper Application

When you import an EAR file, JDeveloper will always create a new application and populate it with projects based on the EAR modules extracted. You cannot add the contents of an EAR file to an existing application or project.

You should not use this procedure to import an EAR file that you simply wish to deploy using JDeveloper. To do this, create a new application and project, then copy your EAR file into the project directory (or add its location to the project's content). The EAR file will then appear in the Application Navigator under the project's Application Sources node. From here, you can deploy the file by right-clicking it and choosing Deploy to.

To open an EAR file and import it into a new JDeveloper application:

  1. From the main menu, choose File > Import and double-click EAR File.

    The Import EAR File wizard is not sensitive to context, so you need not select anything specific in the navigator first.

  2. Complete the Import EAR File wizard.

    On the Finish page, the contents of the final application are displayed.

  3. Click Finish to accept the listing and create the application.

    The new application appears in the navigator, populated with projects based on the imported modules.

5.3.3 How to Import Files into a Project

You can create new files of various types from scratch or open existing ones. When opening existing files, you can import them, along with their file structure, into an existing project or build a completely new project around them.

You can also create new projects from existing source.

5.3.3.1 How to Import Files into a Project

You can import existing files of various types into a project you've already created, while maintaining their original file structure.

Note:

You can use the Import Existing Sources wizard to add.zip or.jar files to projects. You cannot use it to add.war or.ear files. A .war file requires the Import WAR File wizard to property extract its contents into the project. An EAR file requires the Import EAR File wizard, which extracts its contents into a new application.

To open an existing file and add it to a project using the Import Existing Sources wizard:

  1. In the Application Navigator, select the project to which the file will be added.

  2. From the main menu, choose File > Import.

  3. In the Import dialog, double-click Existing Sources.

  4. On the Add Source Files and Directories page of the Import Existing Sources wizard, click Add to open the Select Files or Directories dialog.

    For more information on this or subsequent wizard pages, press F1 or click Help from within the wizard.

  5. In the dialog, navigate to the directory containing the files you wish to add, or to the individual files themselves, and click Open to close the dialog and display the files in the wizard.

    You can return to this dialog as many times as you want, adding as many individual files or directories as you would like, by clicking Add again once you have returned to the wizard.

  6. When you have finished adding files or directories, and have returned to the wizard, you can refine your list by selecting and deselecting individual files or by applying filters. To apply filters, click File Filter or Directory Filter.

  7. When your import list is complete, optionally select Copy Files to Project directory to clone the selected files in your project rather than simply pointing to the original source. If you select this option, accept the default src directory, enter a new directory, or click Browse to navigate to one.

  8. Click Next.

  9. On the Finish page, review the listing of new project files. To accept this list, click Finish.

    The files are now added to the selected project.

5.3.4 How to Manage Folders and Java Packages in a Project

JDeveloper enables you to create custom folders or Java packages within your project to better organize your project files.

To create a folder or Java package:

  1. In the Application Navigator, select the project or folder within which you want to create the custom folder.

  2. On the File menu, select New.

  3. In the New Gallery, under Categories, select General.

  4. Under Items, select Folder to create a new folder. To create a Java Package, under Items, select Java Package.

  5. In the Create Folder or Create Java Package dialog, specify the name of the folder or Java package, and the directory you want to create it in.

To delete a folder or Java package:

  1. Select the folder or Java package that you want to delete.

  2. On the File menu, select Delete.

  3. On the Confirm Delete Folder dialog, confirm the deletion of the folder or Java package. Click Show Folder Files to see the files contained in the folder or Java package.

5.3.5 How to Manage Working Sets

Working sets allow you to configure the navigator to show you a subset of files from your project. This is particularly useful when working with large projects. Before you define your own working sets the only one available is Default, and it is a working set which includes all the files in the current application.

You can run and debug a working set in just the same way as you run and debug a project. This allows you to work on just a subset of a large application, for example a Java EE application, without affecting the entire application or incurring a performance hit.

You can define a working set by selecting from files or containers in the Application Navigator, or by providing include and exclude filter patterns through the Manage Working Sets dialog.

To group objects in the Application Navigator into a working set:

  1. In the Application Navigator, select the objects that you want to include in a new working set.

  2. In the Application Navigator, click the Working Sets icon and select New from Selection.

    This opens a Save As dialog. For more information at any time, press F1 or click Help from within the Save As dialog.

  3. Enter a name for the working set, then click OK.

To create a working set by defining file and directory filters:

  1. In the Application Navigator, click the Working Sets icon and select Manage Working Sets.

    This opens the Working Sets dialog. Use the tree on the left to select the projects to include. In the right panel, select which files in the current project to include. For more information at any time, press F1 or click Help from within the Working Sets dialog.

  2. Click Save As to save the working set.

To create a working set from the results of a search in the Log window:

  1. In the Log window, right-click and choose Save as Working Set from the context menu.

  2. In the Create Working Set dialog, enter a name for the working set.

To see which working set you are currently using:

  • In the Application Navigator, hover the mouse over the Working Sets icon. The name of the current working set is displayed as a tooltip. Alternatively, click the Working Sets icon to bring up a menu in which the active working set is checked.

To change the active working set:

  • In the Application Navigator, click the Working Sets icon and select the working set you want to open.

    Files not belonging to the working set are removed from view.

To edit files and projects in a working set:

  1. In the Application Navigator, click the Working Sets icon and select Manage Working Sets.

    This opens the Working Sets dialog. For more information at any time, press F1 or click Help from within the Working Sets dialog.

  2. Select the working set that you want to change from the Working Set drop-down list.

  3. Make the changes as required.

To restore the view in the Application Navigator to show all files:

  • In the Application Navigator, click the Working Sets icon and select (All Files).

To run and debug a working set:

  1. Ensure that you are using the working set you want to run or debug. This should include the projects that represent the Java EE modules (Web applications, EJB modules) that you are working on and any dependencies.

    Be aware that any projects that are explicit dependencies (in the Dependencies page of the Project Properties dialog) will be included even if they are excluded from the working set.

  2. Choose Run > Use Current Working Set (Java EE Only). Now, when you open the context menu of the source editor or a file or project in the Application Navigator, the run and debug options have "Working Set" as part of the name. For example, Run (Working Set) or Debug (Working Set).

5.3.6 How to Browse Files in JDeveloper Without Adding Them to a Project

Sometimes, you may not want to add files directly to a project, but yet have them handy for browsing. You can bring files into the JDeveloper IDE, without adding them to a project.

To open files in JDeveloper without adding them to a project:

  1. From the main menu, choose File > Open.

    As you are only going to view the files, it doesn't matter which node in the Application Navigator is currently selected.

  2. Navigate to the file or files to be opened. Be sure that the file type field either specifies the appropriate file type or allows all types to be displayed

  3. Select the file or files. You can select as many files, or directories, from the list as you would like.

    Archive files appear twice: once as a virtual directory and then again as a file. If you will be opening an archive file, select its appearance in the list as a directory.

  4. With your selection made, click Open.

5.3.7 How to View an Archive

You can easily inspect the contents of any archive, after first opening the archived file in JDeveloper. You can add the contents of an archive to an existing or new JDeveloper project.

To open an archive in JDeveloper and view its contents:

  1. From the main menu, choose File > Open.

    As you are only going to view the contents of the archive, it doesn't matter which node in the Application Navigator is currently selected.

  2. Navigate to the directory containing the archive. Archive files appear twice: once as a virtual directory and then again as a file.

    If you do not see the archive files, double-check that all file types are being displayed.

  3. Select the second appearance of the archive, the archive as a file, and click Open.

5.3.8 How to View an Image File in JDeveloper

You can easily view any.gif, .jpg, .jpeg, or .png file from within JDeveloper.

To open and view an image in JDeveloper:

  1. From the main menu, choose File > Open.

    As you are only going to view the image, it doesn't matter which node in the Application Navigator is currently selected.

  2. Navigate to the image or images to be opened. Be sure that the file type field either specifies all file types or the image types.

  3. Select the image.

  4. With your selection made, click Open.

    The image is displayed in the main working area of JDeveloper.

To view an image already imported into JDeveloper:

  1. In the Application Navigator, select the image file.

  2. Double-click the file, or right-click and choose Open.

5.3.9 How to Set Default Project Properties

You can set the project properties for all subsequently created projects or fine-tune the properties for any individual project.

When you set project properties for an individual project, you override the default values for that project alone.

To view or change the default settings for a project:

  1. From the main menu, choose Application > Default Project Properties.

  2. In the Default Project Properties dialog, select the appropriate category.

  3. View or set the various properties as desired.

  4. When finished, click OK.

The procedures you follow for setting default project properties are identical to those for setting properties for individual projects — with the exception that, as you are in default properties, you do not need to first select an individual project. Note that some project properties cannot be set from the Default Project Properties dialog.

5.3.10 How to Set Properties for Individual Projects

You can set the project properties for all subsequent projects, or fine-tune the properties for any individual project. When you set project properties for an individual project, you override the default values for that project alone.

Additional project properties are also available, based upon specific tasks such as compiling, or debugging.

To view or change the current output path for an individual project:

  1. In the Application Navigator, select the appropriate project.

  2. From the main menu, choose Application > Project Properties, or right-click and choose Project Properties.

    The Project Properties dialog opens with the input paths displayed on the last page that you viewed.

  3. On the Project Source Paths page, change the output directory as desired by typing in the new values or by clicking Browse.

  4. When finished, click OK.

5.3.10.1 How to Include Libraries in a Project

When you include libraries in a project, the source paths defined for those libraries automatically become part of the project's classpath.

To view the current libraries for an individual project:

  1. In the Application Navigator, select the appropriate project.

  2. From the context menu, choose Project Properties.

  3. Select the Libraries and Classpath node. The libraries currently included in the project are shown in the Classpath Entries list

To add an existing library to a project:

  1. With the project selected in the Application Navigator, open the Project Properties dialog.

  2. Select the Libraries and Classpath node

  3. On the Libraries and Classpath page, click Add Library.

  4. Locate the required library in the selection tree and click OK.

To create a new library and add it to a project:

  1. With the project selected in the Application Navigator, open the Project Properties dialog.

  2. Select the Libraries and Classpath node.

  3. On the Libraries and Classpath page, click Add Library.

  4. On the Add Library dialog, click New.

  5. In the Create Library dialog, enter a name for the new library and select its location.

  6. For each path type, click Add Entry or Add URL as appropriate. To remove a path, or correct an addition, click Remove. To rearrange the order of entries, use the reordering buttons to the right of the display area.

  7. Once you have clicked either Add Entry or Add URL, in the resulting selection dialog enter the filename or browse through the list to select one. When your entry is complete, click Select.

  8. In the Create Library dialog, click OK.

  9. On the Libraries and Classpath page, if finished click OK.

To edit an existing library in a project:

  1. With the project selected in the Application Navigator, open the Project Properties dialog.

  2. Select the Libraries and Classpath node.

  3. On the Libraries and Classpath page, select the library to be altered from the Classpath Entries list.

  4. Click Edit. (This button remains the View button if the library is not editable.)

  5. In the Edit Library Definition dialog, the appropriate library's name should appear in the first field. Make any desired changes to the library name by typing directly into the field.

  6. For each Edit Path dialog, click Add Entry or Add URL as appropriate. To remove a path, or correct an addition, click Remove. To rearrange the order of entries, use the reordering buttons to the right of the display area.

  7. Once you have clicked either Add Entry or Add URL, in the resulting selection dialog enter the directory name or browse through the list to select one. When your entry is complete, click Select.

  8. In the Edit Library dialog, click OK.

  9. On the Libraries and Classpath page, if finished click OK.

5.3.10.2 How to Remove Libraries from a Project

When you remove libraries from a project, the source paths defined for those libraries no longer form part of the project's classpath.

To remove a library from a project:

  1. In the Application Navigator, select the appropriate project.

  2. From the main menu, choose Application > Project Properties, or right-click and choose Project Properties.

  3. Select the Libraries and Classpath node.

  4. On the Libraries page, select the desired library or libraries from the Libraries list and click Remove.

  5. If finished, click OK.

5.3.10.3 How to Set the Target Java SE for a Project

Setting the target Java SE specifies which Java SE JDeveloper will use when compiling and running your project.

To view or change the current Java SE for an individual project:

  1. In the Application Navigator, select the appropriate project.

  2. From the main menu, choose Application > Project Properties, or right-click and choose Project Properties.

    The Project Properties dialog opens with the common input paths displayed or on the last page that you viewed.

  3. On the Libraries and Classpath page the Java SE Version used for the project is displayed. Click Change to define a new Java SE.

  4. When finished, click OK.

5.3.10.4 How to Manage Project Dependencies

Complex applications generally comprise multiple projects, which may be related though dependencies. That is, project A must depend on project B when project A uses classes or resources from project B. When this dependency is set, compiling project A will automatically compile project B.

Deployment profile dependencies are created and edited in the Project Properties dialog available from the Tools menu.

To manage the project dependencies for an individual project:

  1. In the Application Navigator, select the appropriate project.

  2. From the main menu, choose Application > Project Properties, or right-click and choose Project Properties.

  3. Select the Dependencies node.

  4. On the Dependencies page, view the current dependency hierarchy for the project.

  5. Select or deselect projects as desired.

  6. To change the current dependency ordering, click Ordering.

  7. When finished, click OK.

5.3.10.5 How to Associate Features with a Project

When features are associated with a project, JDeveloper's design time filters the choices you see based upon what you are most likely to need for a project of this type.

To associate features with a project via its project template:

  1. From the main menu, choose Application > Manage Templates.

  2. In the Manage Application Templates dialog, click the project template for which the features are to be associated.

    Application templates are listed as first-level nodes under Application Templates. Project templates appear below their application template.

  3. In the panel to the right, select the appropriate features from the Available Project Templates list and use the shuttle buttons to transfer them to the Selected Project Templates list.

  4. When finished, click OK.

To associate features with an individual project:

  1. In the Application Navigator, select the appropriate project.

  2. From the main menu, choose Application > Project Properties, or right-click and choose Project Properties.

  3. Select the Features node.

  4. On the Features page, click the Add Features button.

  5. In the Add Features dialog, select the features to be associated with the project in the Project Features list.

  6. Click the shuttle button to transfer your selection to the Selected list.

  7. Click OK.

5.3.10.6 How to Set Javadoc Properties for a Project

Every project you create carries the JDeveloper project defaults or those you have supplied yourself for all projects. You can also replace these defaults on a project-by-project basis. Setting these properties is the same in either case: only the location, and application, of the information differs.

To set Javadoc properties for an individual project:

  1. In the Application Navigator, select the project.

  2. From the main menu, choose Application > Project Properties, or right-click and choose Project Properties.

  3. Under Profiles, select the active profile node.

  4. Under the active profile node, select the Javadoc node.

  5. When finished, click OK to close the Project Properties dialog.

5.3.11 How to Manage Application and Project Templates

Application and Project templates can assist you in organizing your projects and standardizing on that organization. When you combine templates with features, you can streamline the way you design and produce applications.

5.3.11.1 How to Define a New Application Template

An application template organizes one or more project templates which specify the project types expected in the application. Using such templates enables you to standardize the way you develop an application.

To define a new application template:

  1. Begin the process of creating a new application.

  2. In the Create Application dialog, click Manage Templates. Alternately, if you are not in this dialog, choose Application > Manage Templates.

    For more information at any time, press F1 or click Help from within the appropriate dialog.

  3. In the Manage Templates dialog, select the Application Templates node and click to open the Create Application Template dialog

  4. Enter a name for the new template and click OK.

    The new template appears in the template list of the Manage Templates dialog. All application templates are listed as first-level nodes under Application Templates.

  5. Complete defining the Application Template. For more information at any time, press F1 or click Help from within the Manage Templates dialog.

The application template appears in the New Gallery in the Applications category of the Business Tier.

5.3.11.2 How to Define a New Project Template

Project templates specify the various types of projects expected in a given application. Project templates are contained within application templates.

To define a new project template:

  1. Define a new application template.

    Alternately, if the template has already been defined, choose Application > Manage Templates.

  2. In the Manage Templates dialog, select the Project Templates node and click the Add icon to open the Create Project Template dialog.

  3. Enter a name for the new template and click OK.

    The new template appears in the template list of the Manage Templates dialog. All project templates are listed as first-level nodes under Project Templates.

  4. Complete defining the Project Template. For more information at any time, press F1 or click Help from within the Manage Templates dialog.

The project template appears in the New Gallery in the Projects category.

5.3.11.3 How to Share Application and Project Templates

You can create an application or project template in a shared location. Other users can read templates from the shared location and use the same templates for their application and projects.

To create a shared template:

  1. Choose Application > Manage Templates.

  2. In the Manage Templates dialog, select either the Application Templates or Project Templates node and click the Add a shared location icon.

  3. In the Add Templates Directory dialog, enter or browse to the location where you want the shared template to be stored.

The shared templates folder is listed under both the Application Templates and Project Templates node.

5.3.11.4 How to Edit an Existing Application or Project Template

You can editing existing user-defined application or project templates.

To edit an existing application or project template:

  1. From the main menu, choose Application > Manage Templates.

  2. In the Manage Templates dialog, select the template you want to edit.

    For more information at any time, press F1 or click Help from within the Manage Templates dialog.

  3. In the panel to the right, edit the attributes of the templates as desired.

  4. When finished, click OK.

5.3.11.5 How to Delete an Existing Application or Project Template

You can delete existing user-defined application or project templates.

To delete an existing application or project template:

  1. From the main menu, choose Application > Manage Templates.

  2. In the Manage Templates dialog, select the name of the template to be deleted.

    Application templates are listed as first-level nodes under Application Templates. Project templates are listed as first-level nodes under Project Templates.

    For more information at any time, press F1 or click Help from within the Manage Templates dialog.

  3. Click Delete.

  4. Click OK.

5.4 Managing Application, Project, or Individual Files

This section describes how to save, rename, or close an application, project, or individual component.

5.4.1 How to Save an Application or Project

You can save an application or project in several ways.

To save all the components across applications, including all projects:

  • From the main menu, choose File > Save All or click the Save All icon.

Alternately, you can save components individually by using File > Save.

It is important to note that saving the application or project container (.jws, .jpr) file alone does not save the individual files governed by that application or project. Nor does saving individual contained files save the container node.

Each node is an independent entity and must be saved as such. Using Save All takes care of changes to these container files, as well as all content files.

Using Save or Save As on a selected application or project node saves or duplicates the .jws or .jpr file only: it does not save or duplicate the files contained within the node.

Note too that if you do a Save As on a application or a project container file, that container is replaced, but the files contained are not altered. If you do a Save As on an individual file, that file is duplicated. However, if you want to rename a file, you should use File > Rename.

5.4.2 How to Save an Individual Component or File

You can save an individual component in several ways.

To save an individual component or file:

  1. In the Application Navigator, select the component or file to be saved.

  2. From the main menu, choose File > Save or click the Save icon in the toolbar.

    The file is immediately saved, its italicized name changing to Roman font.

It is important to note that saving the application or project container (.jws, .jpr) file alone does not save the individual files governed by that application or project. Nor does saving individual contained files save the container node.

Each node is an independent entity and must be saved as such. Using Save All takes care of changes to these container files, as well as all content files.

Using Save or Save As on a selected application or project node saves or duplicates the .jws or .jpr file only: it does not save or duplicate the files contained within the node.

You can rename an individual file or component using File > Rename.

Note that if you do a Save As on a application or a project container file, that container is replaced, but the files contained are not altered. If you do a Save As on an individual file, that file is duplicated.

5.4.3 How to Rename an Application, Project, or Individual Component

You can rename application control files, project control files, and individual files. The correct way of renaming Java classes is to use refactoring.

To rename an application or project container, or an individual source file:

  1. In the Application Navigator, select the node to be saved.

  2. From the main menu, choose File > Rename.

    For simple files, the Rename dialog opens. For Java files, the Rename File dialog opens.

  3. If the Rename File dialog has opened, choose between renaming only the selected file, or renaming the file, the class defined by it, and all references to the class

    If you choose to rename the class and update references, the Rename Object_Name dialog opens.

  4. If the Rename Object_Name dialog opens, change the name and choose options as required, then click OK.

  5. If the Rename dialog opens, change the name as required and click Save.

    The node now appears in the navigator with the new name.

Alternately, you can use File > Save As. Note that Rename always replaces the target file. Save As replaces application or project container (.jws, .jpr) files, but duplicates source files.

When you are saving files, remember that saving a container file alone does not save the contents of the entire application or project. For that, you need to use Save All.

5.4.4 How to Relocate an Application, Project, or Project Contents

The Application Navigator presents a visual representation of the logical structure of applications and projects. It is not a file directory. It does not necessarily represent the physical location of those files.

To change the physical location of individual files, you can work in JDeveloper. To change the physical location of a group of files, it is easier to work through your operating system's file manager.

To change the association of files with projects or projects with applications, you would work in the Application Navigator, adding or removing as appropriate.

Note:

The best practice for relocating Java classes is to use the options available on the Refactor menu.

To change the physical location of an individual file, whether within the project or a container (.jws or .jpr) file:

  1. In the Application Navigator, select the file to be moved.

  2. From the main menu, choose File > Rename. If you have chosen a Java file, the Rename File dialog will open. You will be able to relocate the file only if you choose the option Rename the file only, do not update references in this dialog.

  3. In the Rename dialog, navigate to the new location for the file and change the file's name if you wish.

  4. Click Save.

    The file is now physically stored in the new directory. Its logical representation does not change in the navigator unless you explicitly alter it.

To change the physical location of an entire application or directory:

  1. In your operating system's file manager, navigate to the directory in which the files currently reside. Files stored in the JDeveloper default directory reside in the mywork folder.

  2. Select the entire directory (application, project, or files within a project) to be moved and move it to the new location.

    The files have now been moved, but JDeveloper no longer knows where they are.

  3. When you return to JDeveloper, in the Application Navigator, and choose Open Application from the drop-down list.

  4. Navigate to the new physical location of the application or project and click Open.

To change the physical location of a group of files from one project to another:

  1. In your operating system's file manager, navigate to the directory in which the files currently reside.

  2. Select the files to be moved and move them to the new location.

  3. When you return to JDeveloper, select the project in the Application Navigator, and choose Project Properties from the context menu.

  4. In the Project Source Paths page of the Project Properties dialog, use the Add button and navigate to the location of the files you want to add.

    The files are now physically located where you placed them in step 2, and logically associated in the navigator wherever you targeted them in step 4.

5.4.5 How to Close an Application, Project, or Other File

When you close an application, project, or file in the Application Navigator, that application or project is unloaded from memory. When an application or project is closed, it appears in its unexpanded form in the navigator.

In addition, you can remove applications, projects, or files from the navigator, which removes them only from the list, or you can delete them permanently, wherever they reside, from within JDeveloper.

To close an application or project:

  1. In the Application Navigator, select the application or project to be closed.

  2. From the main menu, choose File > Close.

    If any files within that application or project were changed and not saved, you are prompted to save them.

    The application or project now collapses and appears in the navigator with the plus sign indicating that is ready for expansion.

You can close a file opened in a viewer or an editor by clicking on the close box of the corresponding document tab above the editor window.

5.4.6 How to Remove a File from a Project

You can remove files from a project, which removes them only from the navigator list, or you can delete them permanently, wherever they reside, from within JDeveloper.

To remove a file from a project:

  1. In the Application Navigator, select the file or files you wish removed.

  2. Select File > Delete.

  3. The Confirm Delete Dialog is displayed. If you are certain that you want to delete the file, click Yes.

5.4.7 How to Remove a Project from an Application

You can remove projects from the application by deleting the project control file (.jpr) from within JDeveloper.

To remove a project from an application:

  1. In the Application Navigator, select the project you wish to remove.

  2. Select File > Delete Project.

  3. The Confirm Delete Project Dialog is displayed. To confirm the deletion, click Yes.

5.4.8 How to Remove an Application

You can remove an application from within JDeveloper:

To remove an application from the IDE:

  1. In the Application Navigator, click the Application Menu.

  2. Select Close Application.

  3. The Confirm Close Application Dialog is displayed. Select an option based on your preference.

5.5 Managing Libraries and Java SEs Outside the Project Scope

JDeveloper enables you to manage libraries and Java SEs outside the project scope.

5.5.1 How to Import Libraries or Java SEs Outside the Project Scope

You can work with libraries completely outside the JDeveloper project scope, setting them up to be either available to you for use in any of your projects or available to a group of users across an installation.

To work with libraries or Java SEs outside of the scope of a project:

  1. From the main menu, choose Tools > Manage Libraries.

  2. In the Manage Libraries dialog, select either the Libraries or the Java SE Definitions tab.

  3. Select the User node to import libraries for your own use. Select the Extension node to import libraries for use across a group.

  4. Click Load Dir.

  5. In the Load Directories dialog, navigate to the library that you wish to import and click Select.

  6. When finished, click OK.

5.5.2 How to Create Libraries or Java SEs Outside the Project Scope

You can work with libraries completely outside the JDeveloper project scope, setting them up to be either available to you for use in any of your projects or available to a group of users across an installation.

To create libraries or Java SEs outside the scope of a project:

  1. From the main menu, choose Tools > Manage Libraries.

  2. In the Manage Libraries dialog, select either the Libraries or the Java SE Definitions tab.

  3. Select the User node to create libraries for your own use. Select the Extension node to create libraries for use across a group.

  4. Click New.

  5. In the Create Library dialog or the Create Java SE dialog, complete the details for the new library or Java SE.

  6. When finished, click OK.

5.5.3 How to Edit Libraries or Java SEs Outside the Project Scope

You can work with libraries completely outside the JDeveloper project structure, setting them up to be either available to you for use in any of your projects or available to a group of users across an installation.

To edit libraries or Java SEs outside the scope of a project:

  1. From the main menu, choose Tools > Manage Libraries.

  2. In the Manage Libraries dialog, select either the Libraries or the Java SE Definitions tab.

  3. In the tab list, select the library to be edited. Its attributes are displayed in the fields to the right.

  4. To change the Java SE executable, click Browse.

  5. To change the class, source, or doc paths, select the path that you want to change then click one of the buttons beneath the paths panel: Add Entry, Add URL, or Remove.

    You can also reorder the entries, by clicking the up and down buttons in the right margin.

  6. When finished, click OK.

5.5.4 How to Delete Libraries or Java SEs Outside the Project Scope

You can work with libraries completely outside the JDeveloper project scope, setting them up to be either available to you for use in any of your projects or available to a group of users across an installation.

To delete libraries or Java SEs outside the scope of a project:

  1. From the main menu, choose Tools > Manage Libraries.

  2. In the Manage Libraries dialog, select either the Libraries or the Java SE Definitions tab.

  3. In the tab list, select the library to be deleted. You can delete only those libraries you have created.

  4. Click Remove and respond to the confirmation dialog.

    The library is deleted immediately.

  5. To close the Manage Libraries dialog, click OK.