Home » Developer & Programmer » Forms » How to call a java function from Oracle forms? (oracle forms 6i)
How to call a java function from Oracle forms? [message #549000] Tue, 27 March 2012 08:01 Go to next message
Messages: 3
Registered: March 2012
Location: ahmedabad
Junior Member
I am new to Oracle Forms..
I am having Oracle client in my PC and jdk version is 1.6

I had configured below tools in my PC. (windows 2000)
I am having Oracle 9.2 with Oracle Forms Builder 6i

How to call a java function from Oracle forms?
Can you give me the code samples and how to integrate those thing?

Re: How to call a java function from Oracle forms? [message #549008 is a reply to message #549000] Tue, 27 March 2012 08:21 Go to previous message
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member

·oracle Forms 6i
·JDK 1.6

With this I managed to create the hello world example:

Configure PATH environment variables:·


Ex: PATH_TO_JAVA = C:\Program Files


FORMS_HOME\TOOLS\common60\JAVA\IMPORTER.JAR (In my case FORMS_HOME was C:\orant)


Create Java Program

1.Create with your IDE a simple java program, following is mine:
     public class HolaMundo { 
           private String hi=
           "Hey World!!!";
      public String GetHi(){
            return this.hola;
      public String getMultiply(int a, int b){
            return ""+a*b;
     public static void main(String args[]){
            HiWorldhm = new HiWorld();
            System.out.println(hm.GetHi());     System.out.println(hm.getMultiply(5,10));

2.Export it to Jar file (Path has to be the one you put in CLASSPATH environment variable.

Import the classes to Forms

Create a new project in Oracle Forms and also create a Canvas, in the canvas use a Text and a Button. The name of the button: TEXT_HI_WORLD.

Following click on the Menu: Program > Import Java Classes

If everything went Ok then there will be a new window that will show you the package where the Class is, you extend it until there is the HiWorld class. Import it.

In Program Unit now there will be two files:

·HIWORLD (Specification)

This are files generated automatically and needed
to use the class.

Then go back to the canvas, right click on the Button and select the Thrigger WHEN-BUTTON-PRESSED, the programming of this will be:
         v_wb      ORA_JAVA.JOBJECT;
         v_hi      VARCHAR2(20);
         v_wb := hiworld.new();
         v_hi:= hiworld.getHi(v_wb);
         :TEXT_HI_WORLD := v_hiEND;

Now execute the program and click on the button! Smile

Hope this helps Java programmers with no much of knowledge on Forms to integrate with legacy systems! Very Happy

[Updated on: Tue, 27 March 2012 08:25]

Report message to a moderator

Previous Topic: pick single value from range (merged 2)
Next Topic: sequence number to be diplayed in form
Goto Forum:

Current Time: Thu Mar 30 01:53:52 CDT 2017

Total time taken to generate the page: 0.07202 seconds