I have a Java application, this application has images, and I had the same problem: when I generated the .jar (executable) file the images did not appear, but if I were to run directly in NetBeans, it would appear. I solved the problem by putting the image inside a folder I created (data) inside the scr folder, and in the code I did:
new ImageIcon(getClass().getResource("/dados/img.jpg"));
This solved the problem, now the deal is with .txt file, how do I do this? I need to read a txt, in NetBeans it finds the right file, however in the generated jar file it is not found
EDIT
File arq = new File("src/dados/arq.txt");