Creating jar files as part of a test?

Jonathan Gibbons jonathan.gibbons at oracle.com
Mon Mar 31 17:23:30 UTC 2014


If you are going to use test.classes, then

a) you probably want your test to be the only test in its containing 
directory -- otherwise you'll get the classes from other tests in your 
jar file
b) you probably don't want to use library code (@library) because those 
classes will be stored somewhere else.

-- Jon

On 03/30/2014 11:21 PM, Wang Weijun wrote:
> They are in test.classes (system property) I guess.
>
> If you are willing to create MANIFEST.MF yourself (or suppose it's not necessary for you), it's also OK to open a ZipOutputStream, and (putNextEntry, write)*.
>
> --Max
>
> On Mar 31, 2014, at 14:13, David Holmes <david.holmes at oracle.com> wrote:
>
>> On 31/03/2014 4:08 PM, Wang Weijun wrote:
>>> test/java/util/jar/Manifest/CreateManifest.java has:
>>>
>>>      String [] args = new String [] { "cvfm", jarFileName, ManifestName};
>>>      sun.tools.jar.Main jartool =
>>>              new sun.tools.jar.Main(System.out, System.err, "jar");
>>>      jartool.run(args);
>> Thanks Max. I should have clarified that of course one option is to simply run the jar tool programmatically :) But in that case I don't know how to tell it where to find the files that jtreg has compiled - are they simply in the current working directory? (Guess I can find out readily enough :) ).
>>
>> Cheers,
>> David
>>
>>> --Max
>>>
>>> On Mar 31, 2014, at 13:59, David Holmes <david.holmes at oracle.com> wrote:
>>>
>>>> I need to dynamically create a jar file containing some of the classes that form my test, and then use that jar file on a secondary exec of the VM (using ProcessTools). Given we aren't supposed to check-in binary files to the repos, what is the simplest way to generate a jar file using jtreg?
>>>>
>>>> Thanks,
>>>> David



More information about the jtreg-use mailing list