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 trial

Java Java Basics Getting Started with Java Introduction to Your Tools

Sumit Doshi
Sumit Doshi
388 Points

When I am using Console method in Eclipse its showing error - Exception in thread "main" java.lang.NullPointerException

When I am using Console method in Eclipse its showing error - Exception in thread "main" java.lang.NullPointerException

Yes, if you run a Console application outside of the Eclipse environment it'll throw that. Google it - there's a way round this. I'll see if I can find a post I wrote about this exact behaviour in these Forum pages.

Sumit Doshi
Sumit Doshi
388 Points

Yes please thank you. I am trying to solve that error

2 Answers

Here - that gives you some options.

Steve.

There is a way of doing this inside the IDE but it is escaping me right now as it's 23:30 here and I've had a long day! Scanner gives a useful way of running the code without (as in outside; with-out; not unrequiring-of) the IDE, but you can use Console as long as you run within the scope of the Console. Google something like that and Stack Overflow will give you something to work with.

guellaf anas
PLUS
guellaf anas
Courses Plus Student 12,112 Points

as i came across your question , i discover something useful to answer it, just follow this link https://teamtreehouse.com/community/why-doesnt-consoleprintf-or-consolereadline-work-in-the-eclipse-ide-i-get-a-null-pointer-exception, to get the right answer, that tells in IDEs like eclipse they use System.in and System.out object to give and receive info from users, so i hope you will discover the right method to use it in yout test. thanks a lot.