I am working on a project that is configured using the standard Maven directory structure, so I have a folder called "resources", and in this I created a folder called "fonts" and then put the file in it. I need to transfer the full path of the String file (the file that is in my project structure to resources/fonts/somefont.ttf ) to the object I am using from a third-party library, as shown below, I searched for this for a while, but a little confused about the right way to do this. I tried as below, but he cannot find it. I looked at using a ResourceBundle , but it seemed to be related to creating the actual File object when I just needed a path to go to a method like the one below (I don't have a direct method call, so just give an example from my memory):
FontFactory.somemethod("resources/fonts/somefont.ttf");
I thought there was a way, with a project with the standard Maven directory structure, to get the file from the resource folder without using the full relative path from the class / package. Any advice on this is welcome.
I donβt want to use a hard-coded path, because the different developers who work on the project have different settings, and I want to include this as part of the project to get it directly when they check the source of the project.
This is for a web application (Struts 1.3 application), and when I look at the exploded WAR file (which I run the project through Tomcat), the file is located at:
<Exploded war dir>/resources/fonts/somefont.ttf
source share