Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Data Structures - Retired Organizing Data Arrays

Brian Haucke
Brian Haucke
13,717 Points

java-repl question: How do I clear screen / line break?

I think it was explained in an earlier lesson, but I can't remember how to do a line break or clear the screen when I'm in the repl.

3 Answers

Brian Haucke
Brian Haucke
13,717 Points

OK, I figured out why I couldn't do a line break: I was closing my code block {} and entering my code inside it.

  • If I have an open code block { I can just hit enter and move down a line. Just have to remember to close it at the end!

Also, CTRL-L will clear the screen.

Amal Karim
Amal Karim
5,329 Points

To clear it, just type

:cls

If you wanna know available commands, type

:help

It works both on java-repl at Workspace and on java-repl at windows command line.

And thanks for the tip at how to do line break!

Brian Haucke
Brian Haucke
13,717 Points

That works fine in the normal workspace, but if I'm in java-repl and type "clear" I get this message: ERROR: not a statement
clear;
^ ERROR: cannot find symbol
symbol: variable clear
location: class Evaluation
clear;
^

I did some more investigating and it turns out CTRL-L will clear the screen in the java-repl. Still not sure how to drop down to a new line, though.