JavaRuntime Object Properties

Applies to TestComplete 14.70, last modified on April 22, 2021

The JavaRuntime object contains the following properties.

Property List   | View

Name Description
JavaClasses Provides access to classes defined within the Java application. Using this property you can access static non-visual objects and even create the application’s class instances directly from your script code.
JavaClassName Returns the short class name of the Runtime class to which the JavaRuntime object corresponds.
JavaFullClassName Returns the full class name of the Runtime class to which the JavaRuntime object corresponds.
JavaVMIndex Returns the index of the given Java virtual machine among other Java virtual machines loaded to the same process.
JavaVMVersion Returns the version of the Java virtual machine loaded to the process.
Java

This category includes properties that TestComplete provides for Java objects.

Name Description
JavaClasses Provides access to classes defined within the Java application. Using this property you can access static non-visual objects and even create the application’s class instances directly from your script code.
JavaClassName Returns the short class name of the Runtime class to which the JavaRuntime object corresponds.
JavaFullClassName Returns the full class name of the Runtime class to which the JavaRuntime object corresponds.
JavaVMIndex Returns the index of the given Java virtual machine among other Java virtual machines loaded to the same process.
JavaVMVersion Returns the version of the Java virtual machine loaded to the process.
Other Categories

The code below obtains the desired Java class and its method by using the JavaRuntime object.

JavaScript, JScript

function JavaRuntime()
{
  // Obtains the JavaRuntime object
  var RunTime = Sys.Process("Java_App_Name").JavaRuntime;
  // Obtains the desired Java package
  var jPack = RunTime.JavaClasses.Package_Name;
  // Obtains the class
  var jClass = jPack.Class_Name;
  // Obtains the method
  var jMeth = jClass.Method_Name;
  // ...
}

Python

def JavaRuntime():

   # Obtains the JavaRuntime object
   RunTime = Sys.Process("Java_App_Name").JavaRuntime
   # Obtains the desired Java package
   jPack = RunTime.JavaClasses.Package_Name
   # Obtains the class
   jClass = jPack.Class_Name
   # Obtains the method
   jMeth = jClass.Method_Name
   # ...

VBScript

Sub JavaRuntime()

  ' Obtains the JavaRuntime object
  Set RunTime = Sys.Process("Java_App_Name").JavaRuntime
  ' Obtains the desired Java package
  Set jPack = RunTime.JavaClasses.Package_Name
  ' Obtains the class
  Set jClass = jPack.Class_Name
  ' Obtains the method
  Set jMeth = jClass.Method_Name
  ' ...
  
End Sub

DelphiScript

function JavaRuntime;
var RunTime, jPack, jClass, jMeth;
begin

  // Obtains the JavaRuntime object
  RunTime := Sys.Process('Java_App_Name').JavaRuntime;
  // Obtains the desired Java package
  jPack := RunTime.JavaClasses.Package_Name;
  // Obtains the class
  jClass := jPack.Class_Name;
  // Obtains the method
  jMeth := jClass.Method_Name;
  // ...
end;

C++Script, C#Script

function JavaRuntime()
{
  // Obtains the JavaRuntime object
  var RunTime = Sys["Process"]("Java_App_Name")["JavaRuntime"];
  // Obtains the desired Java package
  var jPack = RunTime["JavaClasses"]["Package_Name"];
  // Obtains the class
  var jClass = jPack["Class_Name"];
  // Obtains the method
  var jMeth = jClass["Method_Name"]();
  // ...
}

See Also

JavaRuntime Object

Highlight search results