Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running tests with a specific jre client in gradle

In the world of 64/32 bit native libraries sometimes you need to specify specific jre to run code against. I have 64/32 bit jres installed locally. Default is 64 bit, but i need to run some tests using the 32 bit jvm...

How do i tell gradle the path to 32bit java.exe client on my local system? It cannot be java_home which defaults to the jdk, i just need to specify the jre client for test execution phase in gradle.build.

Something like

        tasks.withType(Test) {
systemProperty "java.library.path", "C:\\here\\nativestuff\\lib"
systemProperty "java.client", "C:\\Program\ Files\ \(x86\)\\Java\\jre7\\bin\\java.exe"}

Tried everything i could think of, no clue how to get it to work

like image 572
niken Avatar asked Oct 19 '22 14:10

niken


1 Answers

I was able to get everything to work by setting gradle.properties:

 jre32home=C:/Program Files (x86)/Java/jre7 

I'm using gradle 2.3 btw

In gradle.build I use:

 test.executable = "${jre32home}/bin/java"
like image 186
niken Avatar answered Nov 15 '22 03:11

niken