Eclipse控制台不显示整个输出 [英] Eclipse console doesn't show the whole output

查看:431
本文介绍了Eclipse控制台不显示整个输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java中,我尝试将一个String作为输出写入控制台。字符串的长度为20166个字符。将字符串打印到控制台后,仅显示字符串的下半部分。

In Java I tried to write a String as an output to the console. The length of the String is 20166 characters. After printing the string to the console only second half of the String appears.

整个字符串是一条长行:

The whole string is one long line:

它的外观如下:
从一开始,有很多空格(应该是字母数字字符),之后还有其他字符串正确显示。

What it looks like: From the beginning there is a lot of whitespaces (which are supposed to be alphanumeric characters) and after that there is the rest of the string displayed properly.

我尝试将控制台编码从默认更改为UTF-16和UTF-8,但没有帮助。

I tried to change console encoding from default to UTF-16 and UTF-8, but it didn't help.

我想要输出的字符串是从特定网页上抓取的文本内容(http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery)。如果我抓取不同的网页没有问题。

The String I am trying to output is text content crawled from a specific webpage (http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery). If I crawl a different webpage there is no problem.

我如何处理字符串:
我使用webservice从网页中获取文本内容。返回的String(文本contet)被正确打印(整体)。我需要处理这个字符串,所以我将所有字符改为小写,并用单个字符替换所有多个空格。

How I process the string: I use a webservice to get the text content from the webpage. The returned String (text contet) is printed properly (whole). I need to process this string so I change all characters to lowercase and replace all multiple whitespaces with the single one.

textContent.toLowerCase().replaceAll("\\s+", " ");

在缩放字符后,我仍然能够正确打印整个字符串,但是在将多个空格替换为

After lowercasing the characters I am still able to print whole string properly, but after replacing the multiple whitespaces with one, the beginning of string is not visible.

你有什么问题吗?

Thakns提前为任何帮助。

Thakns in advance for any help.

推荐答案

控制台的偏好是什么?特别检查设置固定宽度控制台加限制控制台输出。也许你的控制台根本不能容纳一行中的许多字符。

What are the preferences for the console? Especially check the settings "Fixed width console" plus "Limit console output". Maybe your console simply can't hold that many characters in one line.

现在Eclipse最终必须剪切控制台,因为它没有无限量的内存。如果控制台仍被切断,您可以使用这个技巧:打开运行配置对话框(在下拉菜单中找到绿色运行按钮)。

Now Eclipse eventually has to cut the data in the console since it doesn't have infinite amounts of memory. If the console is still cut off, you can use this trick: Open the "Run Configurations" dialog (Found in the drop down menu for the green "run" button).

选项卡常用选项卡在底部的标准输入和输出组中具有选项,以将文件中的所有输出的副本保存。然后,您可以使用操作系统的工具来检查此文件。

The tab "Common" tab has options in the "Standard Input and Output" group at the bottom to save a copy of all output in a file. You can then use your OSs tools to examine this file.

还要注意,很长的行可以使Eclipse慢(即可以挂起几秒钟)。这是由于异常堆栈跟踪的正则表达式匹配模式中的错误。如果发生这种情况,请将行长度限制为1000个字符以内。

Also note that very long lines can make Eclipse slow (i.e. it can hang for a couple of seconds). This is due to a bug in the regexp matching patterns for Exception stack traces. If that happens, limit the line length to 1000 characters or less.

这在Spring中特别是一个问题,有时会创建在消息中有50,000个字符的异常。

This is especially a problem with Spring which sometimes creates exceptions that have 50'000 characters in the message.

如果CDT Global Build Console有类似的问题,请参阅这里: Eclipse CDT Build Console输出不显示整个编译器输出

If you have a similar problem with the CDT Global Build Console, see here: Eclipse CDT Build Console output not displaying entire compiler output

这篇关于Eclipse控制台不显示整个输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆