Dominik Huber4,631 Points
Console console = System.console() --> Why is it not working in my IDE?
I took this course the 2nd time. Now doing everything without workspace but with my own IDE (Intellij). So now I encountered a problem:
I cant use Console console = System.console() --> It just won't work. Can anyone explain me why it's not working outside of the IDE but it's working on the teamtreehouse workspace?
I have a fix for this:
Scanner scanner = new Scanner(System.in); System.out.println("Please enter a letter: "); String guessAsString = scanner.next();
But I want to understand why it's not usable in IDE.
I'm wondering what's meant by "usable only outside IDE" ? Where else could you write a programm?
Jeremy Hill24,307 Points
I could not get it to work in my IDE either. I usually use a Scanner object from importing java.util.Scanner.
Alexander NikiforovJava Web Development Techdegree Graduate 22,144 Points
You can compile and run the program in Unix console/terminal with
Console console code.
That is exactly what they have in Workspaces: Unix console with Bash.
Depending on your OS: you can one start terminal, download files from the workspace and run just like in workspace:
javac Class.java and then
If you want to learn why
Console is not working in IDE, try for example this discussion:
See the best answer voted: guy gives pretty explicit explanation