Executing Java Programs

This topic describes the procedure to execute Java programs.

Oracle® Database Navigator tool enables you to compile and execute Java programs and display the result on the DB Execution Console window. To run a Java method:

  1. Open the Java object class from the DB Browser window in the Java editor.
  2. Click the Execute Method icon from the toolbar menu of the Java editor
  3. Select the public static method in the Java class file you want to run.

    Run Java Method

    1. Alternatively, from the DB Browser window, right-click the Java Class file (or a public static method within it) and select Execute from the context menu.

      Execute Java Method from context menu

    The DB Navigator - Execute Method dialog box opens with details of the target database connection, schema, and session in which the Java method will be run.


    DB Navigator - Execute (Java) Method dialog box

  4. Enter the values of the input parameters in the text box. The permissible character type and max character length for the input parameter(s) displays for each text box. Clicking the Open Value History icon displays the history of parameter values used for previous Java method execution.
    If the input parameter is defined as type array, then clicking the ellipsis (...) icon next to the parameter field opens the Array Editor.


    Array Editor tray in Java execution

    You can add rows in to insert the values to the array (of the declared data type) and save the entry. The input parameter field displays the entered array of values.


    Array Editor with values for Java execution

  5. In the Target Context section, you can select a different Target Schema and Target Session from the available options to execute the method.
  6. Select the Commit after execution check box to auto-commit the execution transaction in the database.
  7. Select the Enable Logging (DBMS Output) check box to capture the execution events in database logs.
  8. Click Execute.

    Once the execution is successfully complete, the results of the executed method displays in the DB Execution Console window. The results include the method input parameter(s) and its output string.


    Java execution results in DB Console

    If the Enable logging (DBMS Output) option was enabled, the DBMS Output tab displays the method execution event statistics.