The correct way for Java to obtain class path

I want to get the compiled classpath of the project (. / target/classes), write a utility class method, and use ClassLoader.getSystemResource (""). ToString () ) to get it.
it"s no problem to run the project directly, but in the Junit test class, the return value becomes the path in the Junit Jar file, similar to
jar.fileVinceUniqUsersUniq.m2UnipositoryUniqjitplatformUnitable.m2Uniplex repositoryUniplazJunitplatformPlatformUniverse 1.2.0Universe 1.2.0.jartransactions Universe METAINFhand versionsbank 9 / . It"s easy to run the project directly, but in the Jar test class, the return value is changed to the path in the Jar file file, similar to
< jar >.
is it because you ran Junit, during the test, so the class path here becomes its class path? Is there any way to solve it?

Apr.01,2021

System.out.println(" : "+ ToolsApplication.class.getResource("").toString());
Menu