2

I'm trying to change the color of specific text in Eclipse's console, for example: regular text is in black, but errors are presented in red color. I'm trying to do the same with the try and catch blocks. Here's my code:

int [] arr = {1,2,6,8}; try { for (int i = 0; i < 9; i++) { System.out.println(arr[i]); } } catch (Exception ArrayIndexOutOfBoundsException) { **System.out.println("You got too long");** } 

Now I want the code surrounded by double asterisks to be in red color in the console, is it possible? and if yes then how? Thank you.

1
  • 1
    Print to error stream System.err.println. Commented Mar 26, 2015 at 14:01

2 Answers 2

2

Open Preferences -> C/C++ -> Build -> Console and then change the colors as you like.

Sign up to request clarification or add additional context in comments.

4 Comments

Your answer is missing the point. The op wants "to change the color of specific text" -- further, your answer is for C/C++ while the question is clearly about Java.
@Thomas Flinkow, The question doesn't mention "java" anywhere while it does specifically mention "Eclipse". It was my first search result to fix the output color in C++ in Eclipse's console, so I'd say the wrong question is being asked here.
@MasterHD I agree with you considering the question does not make use of the java tag, but considering that the code in question contains System.out.println and that the question is not about changing the color for every console output, but only for specific words (programmatically) I still feel like this answer is not correct.
@MasterHD I just added the java tag to avoid confusions and to prevent this question from showing up when someone searches for the output color of console text in C++.
1

You can use grep console plugin for this. Check here for more details

You can also filter/color eclipse console text based on regular expression.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.