Java: Loading resources from the file system

后端 未结 5 418
臣服心动
臣服心动 2021-01-22 18:07

My Project Setup

I have the following project setup:

\\program.jar  
\\images\\logo.png

In my code, I reference th

5条回答
  •  猫巷女王i
    2021-01-22 18:21

    Resources have to be in the class path(s). You may try one of these:

    1. Placing the images into the program.jar.
    2. Like most of the programs, they have a APP_HOME directory, e.g. MAVEN_HOME, register that and refer to your files as File instead - $APP_HOME/the-file.ext (with System.getenv()).

提交回复
热议问题