Freigeben über


Using Java Access Bridge from C# .Net

Hi,

This blog is to help automate Java Swing applications from .Net C# Application using Java Access Bridge (JAB).

Using Java Access Bridge from C#

Java Access Bridge is a downloadable component available from site https://java.sun.com/javase/technologies/accessibility/accessbridge/index.jsp. This gives a set of dlls which contains native code that communicates through JVM with Java Accessibility API on user interface objects of Java application. This way we can communicate to Java application.

This article will explain how to interact with Java Swing applications using the library distributed with JAB: WindowsAccessBridge.dll.

Operations automated on Java Swing Application

I have categorized the different actions that we can automate on a Java Swing application as following:

1. Get value from a particular User interface object.

a. Eg. Get value from a textbox, label etc.

2. Set value to a particular User interface object.

a. Eg. Set value to textbox, label etc.

3. Perform action on a particular User interface object.

a. Eg. Automate Click on Button

4. Handle events on firing of some action.

a. Eg. Automate action that should be taken on click of a button.

WindowsAccessBridge.dll includes functions using which we can perform all the operations.

To import the DLL function, and initialize Java Access use this code:

using System.Runtime.InteropServices;

public class JavaAPIFunc

    {

        [DllImport("windowsaccessbridge.dll", SetLastError = true)]

        internal extern static void Windows_run();

  public JavaAPIFunc ()

        {

            Windows_run();

  }

    }

 

The above code is the first step that is needed to use JAB from .net.I will soon blog on how each operations that I defined earlier can be achieved.

Thanks and Regards,

Rajee

Comments

  1.    Get value from a particular User interface object. a.    Eg. Get value from a textbox, label etc.
  2.    Set value to a particular User interface object. a.    Eg. Set value to textbox, label etc.
  3.    Perform action on a particular User interface object. a.    Eg. Automate Click on Button
  4.    Handle events on firing of some action. a.    Eg. Automate action that should be taken on click of a button. Please post your new article as soon as possible.
  • Anonymous
    January 30, 2011
    Can you please give me some more details about getting and setting values using JAB? Thanks!

  • Anonymous
    February 09, 2011
    please give me some examples about getting and setting values using JAB? Thank you very much. My msn is lishijun722@live.com.

  • Anonymous
    June 14, 2011
    Hi Ujjwal, Did you get any Progress

  • Anonymous
    January 06, 2012
    Guys All Are done We can capture the java object we can Fire action on capture object ...... Mail me with your query.. ujjval_parekh@hotmail.com

  • Anonymous
    July 07, 2012
    Hi Ujjwal, Can you update how you did it. Regards, Ashish

  • Anonymous
    October 15, 2012
    I would like to use Java Access Bridge . I want  to expose an API in JAVA and want to call the API using C#. Can I use the Java Access Bridge ?

  • Anonymous
    April 30, 2013
    Did you hear about the newest java bridge, that enables calling C# methods from Java project, named javOnet? is it OK to buy?

  • Anonymous
    April 04, 2014
    Can you guys please give more details on how we can use java access bridge from C#?.