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 Data Structures - Retired Getting There Type Casting

Ani Azot
Ani Azot
1,754 Points

I can't start java-repl from the workspace console

I get this error in the console when attempting to start java-repl

treehouse:~/workspace$ java-repl bash: /lib.jvm/java-1.8.0/bin/java: No such file or directory

I've tried closing and reopening the console but it doesn't work. Also, I can't start jshell either in this workspace.

Ani Azot
Ani Azot
1,754 Points

I've tried other workspaces and I can't start jshell or java-repl in any of these.

Same here...

Ani Azot
Ani Azot
1,754 Points

ok I barely know a few fragments of the linux terminal but I think I've got jshell working.

I found that if you run the command (from the workspace console) cd /opt/jdk-9/bin ./jshell

this should run jshell

I'll see if I can find where java-repl is installed and maybe we can run it manually using a similar command

Donald Fawcett
Donald Fawcett
600 Points

Hi Ani, I have the same problem with jshell error, I tried the solution you suggested running the command (from the workspace console) cd /opt/jdk-9/bin ./jshell but that didn't work for me....

???

Ani Azot
Ani Azot
1,754 Points

you have to run the commands on separate lines.

first: cd /opt/jdk-9/bin second: ./jshell

Donald Fawcett
Donald Fawcett
600 Points

Yeah got it, thanks Ani for the solution.

Others have been having this problem in the last few hours (https://teamtreehouse.com/community/no-jshell) so seems something is broken in the workspace so I will email treehouse support, hopefully be fixed soon after...

Ani Azot
Ani Azot
1,754 Points

ok so I've figured out how to run java-repl.

[JAVA-REPL] From the console

first: cd /opt/jdk1.8.0_171/bin/

second: java -jar /usr/share/java/java-repl.jar


[JSHELL] From the console

first: cd /opt/jdk-9/bin

second: ./jshell


this should allow you to run java-repl. It looks like the links in .bashrc are pointing to directories which do not exist but this should be a workaround for anyone struggling to run jshell or java-repl

Ani Azot
Ani Azot
1,754 Points

thanks Donald Fawcett I've emailed them also.

Ani Azot
Ani Azot
1,754 Points

ok so I found that if you load java-repl as I did above you might not be able to load any files. I'm guessing because of the workspace file path context missing after the cd command.

to get around this open a workspace as normal and in the console directly after treehouse:/~workspace$

type:

/opt/jdk1.8.0_171/bin/java -jar /usr/share/java/java-repl.jar


This should load java-repl and allow you to load your .java classes etc using the normal package syntax .

sorry about that.

4 Answers

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Hey y'all!

This is all fixed and will work like expected, awesome job finding workarounds!

Thanks for raising this to our attention, and sorry for the confusion!

I just installed java and ran jshell from the command line.

Donald Fawcett
Donald Fawcett
600 Points

Yeah that will work but doesn't solve the issue of jshell apparently not being accessible from workspaces in treehouse at the moment. I emailed treehouse support about the issue, in the meantime Ani's workaround provides a solution that allows jshell session to be started from workspace.

Jshell from the command line on your own computer or from the workspace CMI works exactly the same. If you change your mind about installing JAVA I'm happy to help.