Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 java 程序包含两个使用存储在两个不同 .txt 文件中的数据的操作。它在使用 Netbeans 运行时完全正常,但我将其制成可执行文件,文本文件中的值没有被读取。应该怎么做?
也许问题是代码中 .txt 文件的路径。尝试使用绝对路径而不是相对路径,以确保您的程序可以找到文件,例如将文件放在桌面上,然后将文件名更改为/Users/(name)/Desktop/file.txt
/Users/(name)/Desktop/file.txt