Test's classpath and jar's from $JDK_HOME/lib/

Jonathan Gibbons jonathan.gibbons at oracle.com
Fri Nov 21 18:24:07 UTC 2014


On 11/21/2014 10:14 AM, Jonathan Gibbons wrote:
>
> On 11/21/2014 01:13 AM, Filipp Zhinkin wrote:
>> On 11/19/2014 10:56 PM, Jonathan Gibbons wrote:
>>>
>>> On 11/19/2014 04:50 AM, Filipp Zhinkin wrote:
>>>> Hi,
>>>>
>>>> it there a way to put jars from $JDK_HOME/lib/ (sa-jdi.jar for 
>>>> example)
>>>> into test's classpath like it is possible to do with jars from a 
>>>> location
>>>> relative to TEST.ROOT or test.src using @library tag?
>>>>
>>>> Of course it is possible to write custom driver class that will copy
>>>> required jars to CWD or will wrap javac and java commands and
>>>> will itself substitute required jars to their classpaths.
>>>>
>>>> But maybe a simpler approach already exist?
>>>>
>>>> // BTW, $JDK_HOME/lib/tools.jar is already in tests' classpath. ;)
>>>>
>>>> Thanks in advance,
>>>> Filipp.
>>>
>>>
>>> Just checking -- I presume these jar files are not on the standard 
>>> bootclasspath, right?
>> Right.
>>>
>>> If not, then right now, there is no easy way to do this.
>> That's sad.
>>
>> Thanks,
>> Filipp.
>>>
>>> -- Jon
>>
>
> The sadness exists on multiple fronts.   jtreg has been around since 
> about 1997, and no-one has wanted this feature up to now.
>
> On one hand, we can look at adding this feautre into jtreg. On the 
> other hand, these jars are going away in JDK9, to be replaced by "the 
> Java module system"  (i.e. all the Jigsaw work now going on.)
>
> How big is your use case, so that we can compare and prioritize 
> possible solutions, such as jtreg support vs. cutsom driver support?
>
> -- Jon
>
>
>

FWIW, /if/ we were to put this into jtreg, I could imagine extending the 
@library syntax with something like

     @library $JDK/lib/sa-jdi.jar

jtreg does not currently do  any such substitution, so we can bike-shed 
on that.

An alternative is to extend the interpretation of    @library /a/b/c.    
Current, an absolute path like that is interpreted relative to the root 
of the test directory.   If that fails, we could look it up relative to 
the JDK.

A combination of the two could be the following:

     @library/jdk lib/sa-jdi.jar

-- Jon



More information about the jtreg-use mailing list