I can only access referenced library classes if I save my classes in the default package. If I try to access them from any other package I get “className cannot be resolved”. Any idea why this could happen?

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That package is from the standard library of Princeton’s IntroCS Course after a quick Google.
If you follow down to the FAQ on the page
http://introcs.cs.princeton.edu/java/stdlib/
Download package jar file:
http://introcs.cs.princeton.edu/java/stdlib/stdlib-package.jar
Right click project folder and add external JAR.
Add above line to the classes where you need to reference the classes.
The first line references the correct package name and the * wildcard imports all the classes within it.
🙂 Hope that helps.
//Edit – If you right click the project folder and use “Organize Imports” it will be faster so you don’t have to manually add to each class.