5

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

niken
  • 2,499
  • 3
  • 33
  • 56
  • Possible duplicate of [this question](http://stackoverflow.com/questions/11901737/specifiy-jre-container-with-gradle-eclipse-plugin) or of [this question](http://stackoverflow.com/questions/17110502/choosing-the-correct-jre-version-in-gradle-with-eclipse) – durron597 Apr 17 '15 at 22:05
  • @duffon597 you are wrong on both fronts, first question is related to java version compatibiltiy (ex. 1.6 vs 1.7), the second question is about eclipse... Also the solution provided there doesn't work for me because i don't want to install abother jdk. I have a 32 bit jre, which i would like to tell gradle to ue, there should be some kind of switch for changing the default java client execution path – niken Apr 20 '15 at 13:35
  • Might this one help?: http://stackoverflow.com/questions/18487406/gradle-how-to-tell-gradle-to-use-specific-jdk-version-for-building-an-applica – Anders R. Bystrup Apr 20 '15 at 13:53

1 Answers1

3

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"
niken
  • 2,499
  • 3
  • 33
  • 56