Description
The ApplicationArguments
property specifies command-line arguments for the tested Java application (that is, the parameters to be passed to the application’s main
method). This is the same value you specify in the Command-line arguments parameter in the TestedApps editor.
Note: | Do not confuse these arguments with Java Virtual Machine arguments. To specify the command-line parameters to be passed to the Java Virtual Machine launcher, use the JavaTestedApp.Options property. |
Declaration
JavaTestedAppObj.ApplicationArguments
Read-Write Property | String |
JavaTestedAppObj | An expression, variable or parameter that specifies a reference to a JavaTestedApp object |
Applies To
The property is applied to the following object:
Property Value
A string containing the command-line arguments (separated by spaces) to be passed to the Java application.
Example
The following example adds a new Java application to a project, specifies its launch parameters and then launches the application:
JavaScript, JScript
function Test()
{
// Add a Java application to the project
var ind = TestedApps.AddJavaApp();
var app = TestedApps.Items(ind);
// Specify Java application's launch parameters
app.RunAsJar = true;
app.JVMExecutable = "C:\\Program Files\\Java\\jre7\\Bin\\java.exe";
app.JarFileName = "C:\\JavaApps\\SampleApp.jar";
app.WorkFolder = "C:\\JavaApps";
app.ApplicationArguments = "in data.txt";
app.Options = "-verbose:class";
// Launches the Java application
app.Run();
// Test the application
…
app.Close();
}
Python
def Test():
# Add a Java application to the project
ind = TestedApps.AddJavaApp();
app = TestedApps.Items(ind);
# Specify Java application's launch parameters
app.RunAsJar = True;
app.JVMExecutable = "C:\\Program Files\\Java\\jre7\\Bin\\java.exe";
app.JarFileName = "C:\\JavaApps\\SampleApp.jar";
app.WorkFolder = "C:\\JavaApps";
app.ApplicationArguments = "in data.txt";
app.Options = "-verbose:class";
# Launches the Java application
app.Run();
# Test the application
# ...
app.Close();
VBScript
Sub Test
' Add a Java application to the project
ind = TestedApps.AddJavaApp
Set app = TestedApps.Items(ind)
' Specify Java application's launch parameters
app.RunAsJar = true
app.JVMExecutable = "C:\Program Files\Java\jre7\Bin\java.exe"
app.JarFileName = "C:\JavaApps\SampleApp.jar"
app.WorkFolder = "C:\JavaApps"
app.ApplicationArguments = "in data.txt"
app.Options = "-verbose:class"
' Launches the Java application
app.Run
' Test the application
…
app.Close
End Sub
DelphiScript
procedure Test();
var ind, app;
begin
// Add a Java application to the project
ind := TestedApps.AddJavaApp();
app := TestedApps.Items(ind);
// Specify Java application's launch parameters
app.RunAsJar := true;
app.JVMExecutable := 'C:\Program Files\Java\jre7\Bin\java.exe';
app.JarFileName := 'C:\JavaApps\SampleApp.jar';
app.WorkFolder := 'C:\JavaApps';
app.ApplicationArguments := 'in data.txt';
app.Options := '-verbose:class';
// Launches the Java application
app.Run;
// Test the application
…
app.Close;
end;
C++Script, C#Script
function Test()
{
// Add a Java application to the project
var ind = TestedApps["AddJavaApp"]();
var app = TestedApps["Items"](ind);
// Specify Java application's launch parameters
app["RunAsJar"] = true;
app["JVMExecutable"] = "C:\\Program Files\\Java\\jre7\\Bin\\java.exe";
app["JarFileName"] = "C:\\JavaApps\\SampleApp.jar";
app["WorkFolder"] = "C:\\JavaApps";
app["ApplicationArguments"] = "in data.txt";
app["Options"] = "-verbose:class";
// Launches the Java application
app["Run"]();
// Test the application
…
app["Close"]();
}
See Also
JavaTestedApp Object
Testing Java Applications
Java Application Parameters