Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

simple java repl for mac

I'm looking for a simple java REPL for OSX. For ruby there's irb, for javascript there's node, for python you can just type python and get a REPL. I assumed there would be something easy for Java. I googled around and came across this project: java-repl. I was shocked by how large it was, and then shocked again when I couldn't get it to run. Anyone have a better option?

like image 522
williamcodes Avatar asked Apr 11 '26 21:04

williamcodes


1 Answers

I'd say one of the lightest Java REPLs is BeanShell (http://www.beanshell.org/). It's only ~150kB in size and you can run it simply with:

java -cp bsh-2.0b4.jar bsh.Interpreter

If you're after something even lighter you can give a try to REPL (http://www.scravy.de/blog/2012-02-27/a-read-eval-print-loop-for-java.htm). That's only ~14kB in size but very limited (featurewise)

JDK also comes with jrunscript but that's JavaScript REPL (although you could be able to change the engine to something else, like Java)

like image 155
defectus Avatar answered Apr 13 '26 10:04

defectus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!