JDeveloper 10g Java Environment


Create a Simple Program

Follow these steps to create, compile, and run a simple Java program in JDeveloper:

  1. Create a project. Choose File | New. In the "New" gallery, select the Project folder under Categories (on the left) and Empty Project under Items (on the right).
  2. The "New Project" window will show you the default project location and file name. Note the location so you know where your project files are stored!!! Click OK. A new project node, with a name resembling Project1.jpr will appear in the Navigation pane (far left).
  3. Create a Java file. Make sure your project node is selected, and choose File | New. The "New" Gallery opens again. This time select the Objects folder and double-click the Class icon. In the Class Wizard dialog that opens:
    1. Replace the default class name with "HelloWorld".
    2. Click OK.

    A new file node, named HelloWorld.java will appear under your project node.

  4. Edit the file. Double-click the file node to open the file. Edit the file, adding this method to the definition of the HelloWorld class.
     public static void main(String[] args) {
           System.out.println("Hello, World!");
     }

    The complete code will look like this:

    package project1;
    
    public class HelloWorld {
    
       public HelloWorld() {
       }
    
       public static void main(String[] args) {
           System.out.println("Hello, World!");
       }
    }
     
  5. Build the project. Choose Project | MakeProject. A message will appear, reporting success or failure, in the Status line at the bottom of the JDeveloper window. If there are errors they will be listed in the Message View pane, under the Compiler tab.
  6. Run the project. When the project has been successfully built, Choose Run | Run. Your message will be printed in the Message View pane, under the HelloWorld tab.

Console Applications


Adding Files to JDeveloper

To import files into a new project:

  1. Create a project. Choose File | New. In the "New" gallery, select the Project folder under Categories (on the left) and Project with Existing Source under Items (on the right).
  2. On the 1st step of the New Project from Existing Source Wizard, make sure the Project source path contains the directory where your packages are located.
  1. To invoke the Import Project Wizard, select the project you want to import into in the navigator, then choose Import Classes/Packages from the right mouse context menu.
  2. Location - On the first step of the wizard, make sure your source path contains the directory where your packages are located.
  3. Add Source - On the second step of the wizard, Use the Add Files... button to select a package to import.  Browse to the file folder that contains the files you want to import.
    • Check the Recurse into packages checkbox if you want to import all the files in the directory.
  4. Source Paths - This step in the wizard tells you where the class files will be put once compiled (You can choose another location or go with the default).
  5. Run Settings - This allows you to set which files and classes to run.  You shouldn't have to set the classpath.  You can select the default file to run.  Leave "Attempt to Run Active File Before Default" checked.
  6. Finish

Now your source files will be conveniently grouped by package in the JDeveloper navigator. In addition, the navigator will keep track of files you add and remove from the file system automatically.


Updated June 26, 2005
by Dawn Gregg,