The purpose of this tutorial is to help novice users get started with JDeveloper. It presents the basic concepts on which the tool is built and seeks to familiarize you with the Integrated Development Environment (IDE). Using a simple Java class as an example, you start using the basic components of JDeveloper in order to create a new Application project.
You should be able to complete this tutorial in approximately 20 minutes.
The tutorial covers the following topics:
Overview | ||
Prerequisites | Launching JDeveloper 10g | |
Creating Your First Application | ||
Examining Project Properties | ||
Summary |
This tutorial helps you to get started with JDeveloper. It explains the main concepts of the tool, describes how your work is organized, shows the IDE and guides you through the process of creating your first Java program.
In order for this tutorial to work successfully, you will need to have performed the following:
1. | Install Oracle JDeveloper 10g.
|
Move your mouse over this icon to show all screenshots. You can also move your mouse over each individual icon to see only the screenshot associated with it.
Note: If you open all the screenshots, response time may be slow depending on your Internet connection.
If you already know how to launch JDeveloper, you can skip this topic and jump to Creating your first application.
1. | On your operating system, expand the <JDeveloper home> folder node.
|
2. | Locate the jdev folder and expand it.
|
3. | Open the bin folder and look for the jdevw.exe file
|
4. | Double click the jdevw.exe file to launch JDeveloper 10g. Note: On Windows platforms, you can also choose to run JDeveloper with the console window (using jdev.exe file located in the bin directory), which displays internal diagnostic information.
|
5 . | The launch window displays. Note that on the first time you start JDeveloper, you are prompted with a dialog asking you if you want to migrate from a previous version of JDeveloper. Reply accordingly.
|
6 . | Once loaded, the JDeveloper IDE appears.
|
1. | By default, the JDeveloper IDE displays the Application Navigator pane on the left side of the window. This is the main pane from which you access the components of your application. The structure of the Application Navigator pane is hierarchical and supports workspaces, projects, images, .html files, and more.
|
2. | To create a workspace, right-click the Applications node and select the New option.
|
3. | The New Gallery displays. In the Categories menu, select General and then, from the Items list, select Workspace. Click OK. Note: The workspace is the highest level in the control structure. It is a view of all the objects you currently need, while you are working. A workspace keeps track of your projects and the environment settings while you are developing your Java program. Workspaces are stored in files with the extension .jws. When you open JDeveloper, the last workspace used is opened by default, so you can resume where you left off. When creating a workspace in JDeveloper you have the choice of creating an Application Workspace or a Workspace. An application workspace allows you to create a predefined type of environment, based on prebuilt templates, depending on the type of application you want to create (Web Application, Java Application,...) You can also create your own application template that includes the architecture you need for your development work.
|
4. | In the Create workspace dialog modify the default workspace name Workspace1 to MyFirstApp. Note that the Directory Name changes accordingly.
|
5. | Make sure that the Add a New Empty Project check box is selected and click OK. Note: A JDeveloper project is an organization used to logically group files that are related. A project keeps track of the source files, packages, classes, images, and other elements that your program may need. You can add multiple projects to your workspace to easily access, modify, and reuse your source code. Projects manage environment variables such as the source and output paths used for compiling and running your program. Projects also maintain compiler, run time, and debugging options so you can customize the behavior of those tools per project.
|
6. | In the Create Project dialog, change the default Project Name Project1 to MyProject, then click OK. Note that the Directory Name changes accordingly, and that the project folder is a child of the Application folder.
|
7. | The Applications Navigator should look like this: Note that all nodes in italics in the Navigator pane mean that these elements are not yet saved.
|
8. | Click the Save All button to save your work so far. Italic names now revert to normal font. Note: Whenever you save your workspace, you are
prompted to save all of the current open files. Saving the workspace
does not save the open files, but only the current environment configuration.
To save the open and modified files, select the Save or Save All option
from the File menu.
|
1. | Right click the MyProject node in the Applications Navigator pane and select Project Properties in the context menu.
|
2. | For example, the Input Paths node displays information about Packages and directories. Try selecting various nodes to discover some of the properties that are stored at the Project level.
|
1. | Right click the MyProject node in the Applications Navigator pane and select the New option from the context menu.
|
2. | In the New Gallery, expand the General node, select Simple Files in the Categories list,and Java Class in the Items list. Click OK.
|
3. | In the Create Java Class dialog, change the default name Class1 to Hello. Deselect the Generate Default Constructor check box and select the Generate Main Method one, then click OK. Notice that the package name is the one that was specified when you created the project. (You can also retrieve this in the Project Properties)
|
4. | The new class opens automatically in the Code Editor,
where you should remove the following
|
5. | Add a dot next to the word System (System.),
and notice that the code insight feature implemented in JDeveloper pops
up a list of the available related classes.
|
6. | Type o to directly access classes starting with a "o" letter, or scroll down the list, then select the out option and click Enter.
|
7. | Add a dot next to the System.out statement (System.out.) and JDeveloper displays a new list of the available related classes.
|
8. | Type p to directly access methods starting with a "p" letter, or scroll down the list, then select the println(String) option and click Enter.
|
9. | Between the parentheses ()
enter the following characters: "Hello
World"
|
10. | Your code should look like this:
|
1. | In the Applications Navigator, right-click the Hello.java node and select the Make option from the context menu.
|
2. | At the bottom of the JDeveloper screen a new window should appear (the Log window). If the Log window does not display, use View | Log to display it ( or Ctrl + Shift + L) Notice that when using the Make option to compile your project, JDeveloper saves all the files in your project.
|
3. | In the Applications Navigator, right-click the Hello.java node and select Run from the context menu.
|
4. | The Log window displays the Hello World message.
|
5. | Select the Hello.java node in the Applications Navigator and open the structure pane View | Structure ( or Ctrl + Shift + S) The Structure pane lists all the methods and fields for the currently selected class. If you double-click an item in the Structure pane, JDeveloper takes you to the definition of that item in the source code, displaying and highlighting it in the Code Editor.
|
6. | Click the main node; you should see the corresponding statement highlighted in the Source editor.
|
1. | Code Editor Viewers are where most of the work takes place; this is where you write code and design user interfaces. Open the viewer by double-clicking the Hello.java node in the Application Navigator pane.
|
2. | At the bottom of the Code Editor viewer, choose one of the three tabs according to the task you intend to perform.
|
3. | Click the Class tab to have global view of a class. Use the General tab to review the class general properties.
|
4. | Click the Fields tab to define or review field definitions in your class. Use it to add, modify, or delete fields from your class definition. Each field displays its name, scope, and type listed. To view all of a field's settings, select it and click the Edit button to open the Field Settings dialog.
|
5. | Click the Methods tab and use it to add, modify, or delete methods from your class definition. The list of methods that your class defines is displayed here. Each method is displayed with its primary settings listed. To view all of a method's settings, select it and click the Edit button to open the Method Settings dialog.
|
6. | Click the Event tab and use it to make your class an event source for event sets you select or to register your class's interest in events generated by other components.
|
1. | Click on the Source tab to open the code editor for the Hello.java class.
|
2. | Click in the margin to the left of the System.out.println("Hello World"); statement to create a Break in your Java program. (You can set as many breaks as you wish).
|
3. | Right click the Hello.java node and select the Debug option from the context menu.
|
4. | The code execution proceeds up to the break point (the red arrow in the left margin of the source code editor indicates where the break is occuring). The log window opens and displays the debugging trace.
|
5. | In the Log window, click the "Step into" icon
to execute the current statement.
|
6. | Click the "Resume" icon to finish the execution.
|
1. | Locate the JDeveloper home directory on your operating system. Then expand the <JDeveloper Home>
|
2. | Under the JDeveloper Home directory, expand the following nodes jdev | mywork | MyFirstApp | MyProject
|
3. | Here you can see how files are stored in a simple JDeveloper project. For more complex applications, the following organization is used. |
In this tutorial, you learned how to get started with JDeveloper, as a novice user. You created an application workspace, a project, and a Java class. You also compiled and ran your class. You also saw how files are stored on your operating system.
To learn more about JDeveloper, refer to the JDeveloper OBE page for additional tutorials.