Java: Loading resources from the file system

后端 未结 5 415
臣服心动
臣服心动 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:37

    You need to add a parameter which describes your class path. Should look something like

    java -cp c:\projects\program_dir\bin -jar program.jar
    

    this will put your jar and image on the class path and it will load successfully.

提交回复
热议问题