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 trialSølvi Qorda
14,194 PointsUnable to import the Treet.java file in the repl
When I open the repl and type the commands Craig provides, it works until I try to import com.teamtreehouse.Treet
It tells me that it cannot find symbol, and it points to the period before Treet.
Any ideas? I couldn't make sense of anything on stack overflow...
Thanks in advance. :)
Sølvi Qorda
14,194 PointsHi Chris,
Thanks for your help, when I type import .com/teamtreehouse/Treet.java;
I get a 'Does not exist'. It's definitely in the working directory, I can see it on the left under teamtreehouse
5 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsIn the video, Craig is in the ~/workspaces
directory which has three items: a directory com
, Example.class
and Example.java
. He then does two steps to import Treet
in the java-repl
: load file, then import:
$ java-repl
Welcome to JavaRepl version 272 (Java HotSpot(TM) 64-bit Server VM, Java 1.8.0_20)
Type expression to evaluate, :help for more options or press tab to auto-complete
java> :load com/teamtreehouse/Treet.java
Loaded source file from com/teamtreehouse/Treet.java
java> import com.teamtreehouse.Treet;
Imported com.teamtreehouse.Treet
What are you experiencing that is different in your case?
ibrahim dirir
11,290 PointsWelcome to JavaREPL version 303 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_65)
Type expression to evaluate, :help for more options or press tab to auto-complete.
java> :load com/teamtreehouse/Treet.java
Loaded source file from com/teamtreehouse/Treet.java
java> import com.teamtreehouse.Treet;
java.util.NoSuchElementException
everything seems okay to me i don't know why am getting this error. i am stuck here for a whole week.
ibrahim dirir
11,290 PointsLoaded source file from com/teamtreehouse/Treet.java
java> import com.teamtreehouse.Treet;
java.util.NoSuchElementException
java> import com.teamtreehouse.Treet;
i am getting this error
Chris Freeman
Treehouse Moderator 68,441 PointsCan you add the full session log? Please include a directory listing of ~/workspaces
ibrahim dirir
11,290 Pointscom/teamtreehouse/Treet and my Example.java is in the default package
ottozov
2,266 PointsI found the issue. Double check your Treet.java and Example.java files and make sure Example compiles without warnings.
Chris Freeman
Treehouse Moderator 68,441 PointsChris Freeman
Treehouse Moderator 68,441 PointsIs your
Treet.java
file in the relative directory "./com/teamtreehouse/"? If it is in our current working directory, you can try to use "import Treet".