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 trialChristopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 PointsClear Console Screen in jshell
How do I clear the console screen in jshell. Now I know to exit it I use control D, but how to clear?
6 Answers
Michael Stedman
Full Stack JavaScript Techdegree Student 13,838 PointsTo completely exit out of JSHELL, you us "ctrl-D" if you are using Windows. If you are using Mac, it is "cmd-D".
"ctrl-L" (on Windows), and "cmd-L" (on Mac) will just clear the screen, but leave you in JSHELL. When I am exiting out of JSHELL, using "ctrl-D" (on Windows), it usually takes a few seconds before the regular console shows up. Long enough that I am thinking that it might not have worked. Once the "treehouse:~/workspace$" shows up, I type in "clear" to clear everything off of the console.
Brent Williams
3,402 PointsControl-L will clear the jshell console screen
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 PointsHi Brent it clears it yes, but what if you want to get out of jshell completely?
ben rodriguez
6,382 Pointscmd d didn't work for me either. /exit works
Alex Arzamendi
10,042 PointsFound on SO that in order to do that we need to implement the following command, tried it out myself and it worked
System.out.print("\033[H\033[2J");
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 PointsI am using a MacBook Pro and it is failing to work,
Alex Arzamendi
10,042 PointsFunny, I am on the same computer and it is working on mine. It was not instant though, a good 7 seconds or 10 seconds passed before it cleared the screen.
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 PointsHi Alex thanks it finally worked! I had a syntax error.
xielit
1,081 PointsHi guys. I am using a Mac book pro and neither the Cmd L and the Cmd D worked. When I press Cmd L the window selects the page URL on the browser...:(
Teacher Russell
16,873 PointsTeacher Russell
16,873 PointsI'm in the cmd, windows 10, and ctrl + L doesn't work here. It just creates a new line.
Anyone? Anyone?.........