Java: Loading resources from the file system

后端 未结 5 407
臣服心动
臣服心动 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条回答
  •  有刺的猬
    2021-01-22 18:25

    You should really include your resources in your JAR.

    Failing that, you can parse the absolute path out of the Main class resource. Assuming your Main class is actually called "Main":

    Main.class.getResource("Main.class").getPath();
    

提交回复
热议问题