Understanding -nativepath and how it is applied

David Holmes david.holmes at oracle.com
Tue Feb 18 07:21:11 UTC 2020


I have a test that uses native code.

I specify "@run main/othervm/native" for the main test class

I invoke jtreg with -nativepath

My test exec's a second VM that needs to load the native library. This 
is done using ProcessTools.executeTestJvm.

When I run the test locally it works fine and if I print out 
java.library.path it shows that the "nativepath" value has been set in 
that property.

But when I run the test via our testing system it fails because the 
native library cannot be found! The jtr file shows -Dtest.nativepath 
being set as expected, but the exec'd VM doesn't have its value in 
java.library.path!

I can obviously fix this by explicitly adding -Djava.library.path=... as 
an explicit arg to the exec'd VM, but I want to understand how this 
works in the local case but not otherwise.

I'm also wondering whether this is something that should be 
automatically handled at the ProcessTools level?

Thanks,
David


More information about the jtreg-use mailing list