2

I need a Java REPL/shell to quickly test some class files. Since they are mostly throwaway code, I don't want to have to bother writing full-blown unit tests. And writing a Main class is also too much extra work for some quick testing.

Matt
  • 21,026
  • 18
  • 63
  • 115
  • If you don't mind learning a little Scala, the Scala REPL works well. Or maybe Jython (if you dont mind learning a littly Python) – Gyro Gearless Mar 18 '14 at 10:00
  • @GyroGearless I do know Python, but I know nothing about Jython and how it interacts with Java classes. – Matt Mar 18 '14 at 10:10
  • [BlueJ](http://www.bluej.org/) has a REPL, they call it "codepad". – fredoverflow Mar 18 '14 at 10:14
  • @GyroGearless I tried Jython and intuitively figured out how to work it without reading any documentation. Thanks for the suggestion, you should post it as an answer! – Matt Mar 18 '14 at 10:19
  • what's about http://www.javarepl.com ? – Mathias Begert Mar 18 '14 at 11:30
  • @MathiasBegert that doesn't allow me to test my own classes. I'm not trying to experiment with Java for the first time or anything like that. – Matt Mar 18 '14 at 11:37
  • This [thread][1] answers this better. [1]: http://stackoverflow.com/questions/397488/is-there-something-like-pythons-interactive-repl-mode-but-for-java/15962251#15962251 – sandeepkunkunuru Jul 14 '14 at 21:44

2 Answers2

1

Since no one else answered, I'll answer myself. I used Gyro Gearless's idea from the comments above. I installed Jython and it worked very well as a REPL to test out my Java classes.

Matt
  • 21,026
  • 18
  • 63
  • 115
1

Just stumbled here.

As mentioned in Mathias Begert's comment, there is an on-line Java REPL at http://www.javarepl.com/console.html and the sources are available from GitHub https://github.com/albertlatacz/java-repl

jschiavon
  • 527
  • 5
  • 10