How does Java resolve file pathname when the project is compiled?

60 Views Asked by At

In my source code, I created a Java File object pointing to a static image file with the pathname src/a/b/c/img.jpeg. When the project is built, I did not see the static image file included in the build directory. When I execute the program - how does the pathname still get resolved? I assume the correct pathname will be pointing to build/a/b/c/img.jpeg but the static image file is not found in the build directory. In addition, does the pathname somehow get converted from src/a/b/c/img.jpeg to build/a/b/c/img.jpeg during compilation? Since the file path should be different when it is compiled. Am I misunderstanding something fundamental here?

0

There are 0 best solutions below