GURVINDER SINGH10,589 Points
Installing Java REPL
I will really appreciate if people at treehouse can make a video lesson on how to install 'javarelp'. It turns out to be really difficult to install it on mac.
If you visit the video where the java-repl tool is first talked about, it has helpful links directly below the video in the "Teachers Notes".
If you go to the java-repl GitHub page it gives you the link to the download and tells you how to run it under "Usage".
I understand that most people aren't familiar with running jar files as programs, so I'll list this out step-by-step.
Step 1: Download java-repl.jar
Open a terminal and navigate to where the tool was downloaded to. If you downloaded it to your Downloads directory just type
Run this command in the terminal to start the java-repl
java -jar javarepl.jar
All done! Use
ctrl+c to terminate the utility.
Note: I changed your question from "Android" to "Java" because the java-repl tool is never talked about in the Android courses.
Michael Acosta Pegoraro4,911 Points
It's turns out to be easier than you think! I found an awesome way of installing a lot of tools via the terminal command.
I went here: http://brew.sh/
To install brew just run this on the terminal: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
it will ask for your/admin password.
Then install javarepl: brew install javarepl
To run it, just type: javarepl
Found the info here: https://www.learnhowtoprogram.com/lessons/java-repl
And you are good to go!
It's also helpful for installing other tools like download managers like wget that I use often on Linux. I switch between Mac and Linux so I am most of the time on the terminal. Even tho Treehouse has the workspace option to work on, I prefer to work local on my computer.
Jozef Bača6,432 Points
Thanks Ernest, i was searching for it for a long time. :) It is also good to create alias in .bashrc or .bash_aliases (this files should be located in your home folder) like this:
Step 1: Write this line into the file .bashrc or .bash_aliases:
alias java-repl='java -jar path/to/file/javarepl.jar'
Step 2: To reload .bashrc or .bash_aliases, write this in terminal:
source ~/.bashrc or
Step 3: All done! From now on you can run it from terminal by typeing:
Waldo Alvarado16,322 Points
Here's what I tried that worked for me.
In the Command line, once you're in the directory where you saved the javarepl.jar
(1) find the location (path) of where you installed you're JDK (java). In my case that was: C:\Program Files\Java\jdk1.7.0_79\bin
(2) Add a "\java" to that path so that you end up with: C:\Program Files\Java\jdk1.7.0_79\bin\java
(3) Encase it in quotes: "C:\Program Files\Java\jdk1.7.0_79\bin\java"
(4) Finally in type in: "C:\Program Files\Java\jdk1.7.0_79\bin\java" -jar javarepl.jar then hit enter and if it works you should see this--------->
Welcome to JavaREPL version 303 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_79) Type expression to evaluate, :help for more options or press tab to auto-complete. java>
Jozef Bača6,432 Points
Hi Matthias, i was out from treehouse for a while, so sorry for delay. You are able to find .bashrc in your home folder only when you try install javarepl on linux. But some versions of linux use a different bash, so you need to find out which type of bash you have on your linux distro. And also file is hidden so maybe if you setup to view hidden files, you will find .bashrc. Dot at the beginning of file name, means that the file is hidden.