我正在使用 Netbeans 开发 Java 应用程序,但是当我在 Debug 中运行我的应用程序时,或者从 Netbeans 直接运行它时,我的屏幕如下所示:
.然而,当我尝试从 dist
文件夹中的 Built jar 运行时,它看起来像这样: .
这是我用来接收内容的方法。该方法旨在从网络上获取文本文件的来源。
public static ArrayList<String> getUrlSource(String urlF) throws IOException {
URL url = new URL(urlF);
Scanner s = new Scanner(url.openStream());
ArrayList<String> fileLines = new ArrayList<>();
while (s.hasNextLine())
{
fileLines.add(s.nextLine());
}
return fileLines;
}
最佳答案
您正在查看 UTF-8 Byte Order Marker
The UTF-8 representation of the BOM is the byte sequence 0xEF,0xBB,0xBF. A text editor or web browser misinterpreting the text as ISO-8859-1 or CP1252 will display the characters  for this.
关于java - 构建时显示奇怪的字符,但不显示调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33445439/