title: Calling Java from PL/SQL
body: <p>Can any one please help me on this: I want to call one java program from the Pl/SQL, Oracle RDBMS, the below are the settings</p>
  
  <p>Windows 7 machine, Java is installed on 
  C:\Program Files\Java\jdk1.7.0_02</p>
  
  <p>I created one directory to keep the java files. D:\Java, it has one hello.java file in it.</p>
  
  <pre><code>public class Hello
  {
    public static String world()
    {
      return "Hello world";
    }
  }
  </code></pre>
  
  <p>this was compiled fine, and the .class file was generated in the same directory.</p>
  
  <p>Since I have to call this function using PL/SQL, here is the PL/SQL function I've written:</p>
  
  <pre><code>create or replace
  FUNCTION helloworld RETURN VARCHAR2 AS
  LANGUAGE JAVA NAME 'Hello.world () return java.lang.String';
  </code></pre>
  
  <p>and this is the PL/SQL procedure:</p>
  
  <pre><code>create or replace
  PROCEDURE hellow
  AS
    my_string varchar2(400 char);
  begin
    my_string:=helloworld();
    dbms_output.put_line('The value of the string is ' || my_string);
  end;
  </code></pre>
  
  <p>both the function and the procedure compiled fine using the SQL/developer.</p>
  
  <p>When I tried running this procedure:</p>
  
  <pre><code>set serveroutput on;
  execute hellow;
  </code></pre>
  
  <p>the following error is coming:</p>
  
  <pre><code>Error starting at line 2 in command: execute hellow Error report: ORA-29540: class Hello does not exist ORA-06512: at "ORACLE_SOURCE.HELLOWORLD", line 1 ORA-06512: at "ORACLE_SOURCE.HELLOW", line 5 ORA-06512: at line 1
  29540. 00000 -  "class %s does not exist"  
  *Cause:    Java method execution failed to find a class with the indicated name.
  *Action:   Correct the name or add the missing Java class.
  </code></pre>
  
  <p>I placed the .class file in the bin folder also, but still the same error is coming.
  Can anyone please have a look at this.</p>