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 trialIra Salem
10,331 PointsClear not a statement
For some reason when I try to use the "clear" command just to keep up with him in this here video, I get an error message stating "not a statement".
Anyone know why this is?
3 Answers
William Li
Courses Plus Student 26,868 PointsRemember that you have to exit the Java REPL first, then you can use the clear command to clear the screen.
Justin Butler
6,113 PointsBut in this video 6:15. After Craig typed ':cls', the console show you treehouse:~/workspace$. It just is minor but wasa curious.
William Li
Courses Plus Student 26,868 PointsHi, Justin Butler , actually during the video, Craig also mentioned that, as soon as he typed :cls, the Java REPL was crashed, that's why it got sent back to the workspace command line.
Now, if you type :cls and it does what it does, clearing up the Java REPL screen instead of crashing Java REPL, that's great, because that means the Java REPL is updated to have one less crashing bug, and becomes more stable.
Ira Salem
10,331 PointsIra Salem
10,331 Pointsyou mean like ":cls"?
William Li
Courses Plus Student 26,868 PointsWilliam Li
Courses Plus Student 26,868 Pointsyeah, :cls should work within Java REPL
but if you want to use the clear command, you have to exit the JAVA REPL and back to the console in order to use it, as this clear command is available in the native Console only.
Stephen Bone
12,359 PointsStephen Bone
12,359 PointsSo if you want to exit the java-repl use the keyboard shortcut ctrl+c or type :exit before you can compile and run the code with the commands - clear && javac file.java && java file
You can tell if you're in the java-repl as your prompt will say java> rather than just something like treehouse:~/workspace$
William Li
Courses Plus Student 26,868 PointsWilliam Li
Courses Plus Student 26,868 Pointsthanks Stephen for the detailed explanation :)
Ira Salem
10,331 PointsIra Salem
10,331 PointsAwesome! Thank you both. Wish I could mark you both as best answer.