JRE Class not found when compiling using Software-model

software-model

(Jean-Daniel) #1

I’m working on OS X and I’m trying to build a very basic jar using the following script (using Gradle 2.12-rc-1).

Actually, the script fails because I’m using an Apple specific classes (like com.apple.concurrent.Dispatch or com.apple.eawt.*) which are documented and expected to be accessible.

The compilation step fails with the error: “error: package com.apple.concurrent does not exist”. That package is part of rt.jar which is use the main JRE jar, so it should be found. Moreover, I did try to explicitly add rt.jar to the compile class path, and I got the same error. My classes compile fine when using javac directly, or using an IDE, so Gradle obviously do something to prevent the system to find them.

Can someone help me to find a way to make the class compile ? My grade script is simply:

plugins {
id 'jvm-component’
id ‘java-lang’
}

model {
components {
main(JvmLibrarySpec) {
targetPlatform “java8”
}
}
}