Java Java Data Structures Getting There Type Casting

Open in JShell

Hello! I have a very basic question about JShell. In the video, Craig used Java REPL, which I assume does about the same thing as JShell does. I tried to follow along in JShell, since that's the REPL I've got used to and have been using since I started learning Java. However, I couldn't quite figure out how to open I tried "/open com/teamtreehouse/", which I figured would be the most reasonable command. But it gives me this error message:

Illegal start of expression 
package com.teamtreehouse;

After a few google searches, I understand that the command I used to open the file supposedly should work, so now I need help figuring out what mistakes I've made and what is the correct way to open a file in a package.

Thanks in advance!

3 Answers

Bump. Having the same issue, I know this is old but it never got an answer.

John Reese
John Reese
1,151 Points

Try commenting out "package com.teamtreehouse;" from the top of the file (// will comment a line out), and then:

/open com/teamtreehouse/

in jshell.

Andrew Menning
Andrew Menning
10,050 Points

You can import the Treet class using the following line inside jshell:

jshell> import com.teamtreehouse.Treet