getClass().getResourceAsStream() in maven project

前端 未结 3 750
轻奢々
轻奢々 2021-02-18 20:58

The pom.xml of my maven project looks as follows:



        
3条回答
  •  一生所求
    2021-02-18 21:57

    I got this error but through ton of Googling, I could not find the solution. All the answers are about the path, nobody cares that It can run in Eclipse but not in exported jar file :(

    But now I found solution, so simple: In Eclipse right click on your maven project-> Properties -> Java build path -> Source Tab

    You can see a tree like :

    MyProject/src
       Ouput follder..
       Included (**/*.java)
       Excluded
       ...
    

    Double click on Included (**/*.java), remove the existing one so It become Included (All) Now export the jar file :)

提交回复
热议问题