Can a jar be prepend to the bootclasspath?

Is there a way of prepending a jar to the bootclasspath used by the Java compiler and execution system within Gradle.

Background is that to test the JSR166 the jar must be loaded by the bootloader not the system loader and it must appear before rt.jar in the classpath.

I think you want to take a look at: http://forums.gradle.org/gradle/topics/gradle_version_of_ants_bootclasspath

Thanks for the pointer to that exchange.

The solution Karl-Johan said he went for is the solution that I had and I think is wrong. The bootclasspath may contain more than just rt.jar and you have to give the path to one rather than just use the one that would have been used anyway, i.e. there is the possibility of using incompatible jars.

I’ll move future posts there though now I know about it.

Scary to see ones name a long time after a post…

Russel is most right, my solution was not very pretty and infact i found what I was after by doing:

compileSomethingTask {

options.compilerArgs = ["-Xbootclasspath/p:"+configurations.bootStrapJars.asPath] }

and/or: testSomethingTask {

jvmArgs = ["-Xbootclasspath/p:"+configurations.bootStrapJars.asPath] }

May not fit your usecase though