On 11/06/2008, Nikesh Goel <[EMAIL PROTECTED]> wrote:
> Hi, I am new to this list so please excuse me if you are receiving this
>  message in duplicate. Please see my question below.
>  Thanks!!
>
>
>  Hi
>
>  How can I setup my JAVA code to run the testfile (.JMX file) and collect the
>  logs in some .xml file ?
>
>  The help file (help.txt) which comes along with the installation shows
>  running the Apache Jmeter in non GUI mode by using the following command on
>  command prompt
>
>  *java -jar ApacheJMeter.jar -n -t test-file [-p property-file] [-l log-file]
>  *
>  The same I have to achieve using JAVA code without any script file. I do not
>  want to run using Runtime.exec(..) as this will spawn a new process. I am
>  actually running a WAS 5.1 server with database connections and other
>  resources managed by the server. If a new process spawns, I think it will
>  not have access to those resources.

But will JMeter have access to the resources even if it is run in the
same process?
How do you propose to give access to the resources?

>  So I am trying something like code snippet below but not certain of passing
>  the testfile and logfile parameters. Kindly suggest something on how to
>  achieve this.

Looks OK, but please consult the appropriate Java documentation for invoke().

You could also have a look at the code for the JMeter Ant task.

>   Class[] argTypes = new Class[1];
>
>  argTypes[0] = String[].class;
>
>  try
>
>  {
>
>  Method mainMethod =
>  Class.forName("org.apache.jmeter.NewDriver").getDeclaredMethod("main",
>  argTypes);
>
>  String[] argListForInvokedMain = new String[2];
>
>  argListForInvokedMain[0] = "-testfile=test.jmx";
>
>  argListForInvokedMain[1] = "-logfile=test-1-1-1.xml";
>
>  mainMethod.invoke(null, argListForInvokedMain);
>
>  }
>
>  catch (Exception e) {
>
>  e.printStackTrace();
>
>  }
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to