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.
当我在 Netbeans 中运行我的应用程序时,一切正常 - 我可以读/写 unicode 文本和文件名,但是当我通过双击或使用 java -jar test.jar 运行 jar 时,我只会得到奇怪的符号......
这是一个已知的问题?我使用 jdk 1.7 但用它构建 1.6 字节代码...
在此先感谢您的帮助:D
编辑:我不是在谈论标准输出 - 该应用程序读取和写入文件并具有 GUI
如果我从终端 System.getProperty("file.encoding") 运行应用程序,则会输出 cp152,但如果我从 Netbeans 运行它,则会产生 UTF-8。这个: java -Dfile.encoding=UTF-8 -jar XY.jar 解决了我的问题,但我不喜欢这个解决方案......