Open Treet.java 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 Treet.java. I tried "/open com/teamtreehouse/Treet.java", which I figured would be the most reasonable command. But it gives me this error message:
Error: 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!
Bump. Having the same issue, I know this is old but it never got an answer.
John Reese1,151 Points
Try commenting out "package com.teamtreehouse;" from the top of the file Treet.java (// will comment a line out), and then:
Andrew Menning10,050 Points
You can import the Treet class using the following line inside jshell:
jshell> import com.teamtreehouse.Treet