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 trialSaad Zafar
905 PointsWhy doesn't console.printf or console.readLine work in the Eclipse IDE? I get a null pointer exception.
Why doesn't console.printf or console.readLine work in the Eclipse IDE? I get a null pointer exception.
In the top we import java.io.Console; and I have that in the code as well. Is there a part of this course that explains this?
2 Answers
markmneimneh
14,132 PointsAdding to what Adam stated, in Eclipse IDE, you can use System.out.printf instead of console.printf and it should be fine.
Adam Sawicki
15,967 PointsIn IntelliJ IDEA there is the same problem. The issue is that most IDEs to run programs use program javaw instead of java. This program runs without any link with system console but it supports input/output streams. IDEs use their own way to communicate and input information during program flow it uses System.in, System.out to show all needed information in prepared tab called probably "Console" (I don't use Eclipse ;))
Saad Zafar
905 PointsThanks for the answer that makes sense.
Saad Zafar
905 PointsSaad Zafar
905 PointsThank you!