Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Data Structures 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.