I have created a jar file, test-example.jar, and added under src/test/resources
and now I want to make sure that when I run the testcase
this jar file is loaded so I can access files in it. I am using java 11.
Q1: How to load jar, in testcase, at runtime?
Q2: How to access resource in jar. Resource resides in jar with the following path suites/tools/device/nc/testng2.xml
Hi,
I have created a jar file, test-example.jar, and added under src/test/resources
and now I want to make sure that when I run the testcase
this jar file is loaded so I can access files in it. I am using java 11.
Q1: How to load jar, in testcase, at runtime?
Q2: How to access resource in jar. Resource resides in jar with the following path suites/tools/device/nc/testng2.xml
br,
//mike
On 21/06/2022 17:38, mike wrote:
Hi,
I have created a jar file, test-example.jar, and added under src/test/resources
and now I want to make sure that when I run the testcase
this jar file is loaded so I can access files in it. I am using java 11.
Q1: How to load jar, in testcase, at runtime?
Q2: How to access resource in jar. Resource resides in jar with the following path suites/tools/device/nc/testng2.xml
br,
//mikeNormally, what you put under /src is what you want packaged (in a JAR,
WAR, etc.).
If you put a JAR there, and your sources are packaged as a JAR, you'll
end up with JAR inside your JAR. Which I would say is definitely
technically workable. I'm not sure whether it's a recommended practice
or not.
To load such a JAR file, you'd have to load it as a resource
Thread.getThread().getContextClassLoader().getResource(NAME_OF_THE_JAR_FILE)
op didn't say if they're trying to package a jar inside another jar or just build a war.
Hi,src/test/resources
I have created a jar file, test-example.jar, and added under
sounds like test-example.jar is a jar file in the src/test/resources path, not what they're trying to buildop didn't say if they're trying to package a jar inside another jar or just build a war.On 21/06/2022 17:38, mike wrote:
Hi,
I have created a jar file, test-example.jar, and added undersrc/test/resources
--
DF.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (2 / 14) |
Uptime: | 71:23:35 |
Calls: | 6,712 |
Files: | 12,244 |
Messages: | 5,356,970 |