I cannot refer to the resource when it is made into a jar.
Create a folder under src / main / resources and place the text file.
In such a situation, when I execute it from Eclipse, the contents of the text file are output correctly, but when I export it to a jar with Eclipse and execute it, it cannot be referenced and an exception occurs.
■ It is an image of the execution result that the contents defined in Eclipse and the contents of File1.txt are output after test execution.
■ It is an image when a Null reference exception occurs when executing after checking the contents of the Jarized file and confirming that File1.txt is included.
There may be a setting to refer to the resource correctly in the jar state, or there may be a problem with the logic, but it is a situation where you can not get a clue.
Could you please tell me if there are any possible problems?
Recommended Posts