How to specity the -agentlib option in a jtreg test?

Alexander Kulyakhtin alexander.kulyakhtin at
Fri Apr 15 15:19:37 UTC 2016

Hi Staffan,

Thank you very much for your suggestion.
I wanted to avoid that workaround, since the -agentpath parameter would require taking care of different file extensions for different platforms and of other things not directly related to the test.
However, if that's the only option I'm going to do as you have suggested.

Best regards,

----- Original Message -----
From: staffan.larsen at
To: alexander.kulyakhtin at
Cc: jtreg-use at, dmitry.fazunenko at, aleksey.voytilov at
Sent: Friday, April 15, 2016 5:53:01 PM GMT +03:00 Iraq
Subject: Re: How to specity the -agentlib option in a jtreg test?

I don’t know why it does not work for -agentlib, but as a workaround you can create an @driver class that launches your test program with the -agentpath parameter and get the location of the native libraries through the system property test.nativepath.


> On 15 apr. 2016, at 16:29, Alexander Kulyakhtin <alexander.kulyakhtin at> wrote:
> Hi,
> I'm trying to create a jtreg test which compiles and then executes a java class with the -agentlib option (to test some JVMTI functionality)
> In my test I have
> @compile
> @run main/othervm -agentlib:mylib MyTest
> I run the test with:
> jtreg -nativepath:<path to> MyTest
> However, it fails with:
> "Could not find agent library mylib on the library path, cannot open shared object file: No such file or directory"
> The -nativepath does provide for the successful loading of the library when I use System.loadLibrary("mylib").
> However, for the -agentlib option, it does not help.
> Does someone know if it is possible to specify the library path for the -agentlib option, from within a jtreg test or using the jtreg options?
> Thank you very much for your help.
> Best regards,
> Alexander

More information about the jtreg-use mailing list