Tag Archives: London Java Community

JShell: upcoming Java REPL, packed into JDK9

Hack the Tower, Hack the OpenJDK

Hack the Tower is a monthly developer meetup in Heron Tower on the 26th floor with stunning view to London. There are two communities behind this hackathon:

London Java Community

London Scala Users’ Group

Adopt OpenJDK team is a regular member of the hackathon, leaded by Mani.

I had a chance to play with JShell, the upcoming Java REPL.

First steps with JShell

Here is a well-written introduction how you can install JShell, currently it’s Kulla Project but I believe it’s going to be a command under JDK’s bin folder, called jshell. Quick bypass: I researched for JShell and found some existing implementations of it. Geophil, for instance, is a shell implementation that was in use with JDK 1.1.

One of the major points of developing JShell is to reduce the learning curve, eliminate boilerplate codes and focuse on the exact solution. You don’t need a main class to print out something, you can do that with System.out.println(“Hello JShell”) only. If you’re writing a command, semicolon is optional. It would be nice in real Java code as well.

My favourite features list

1. eliminating checked exceptions

You don’t need to be worried about try-catch blocks, JShell pushes checked exceptions behind the curtain so you can just write a code like this:

-> Integer testInt = Integer.parseInt("1")

2. saving the workspace into a file

You can create your own methods:

-> Integer myIntegerParser(String number){ return Integer.parseInt("1");  }

Be careful, semicolon is not optional within a function!

Now you can use your function:

-> Integer testTwo = myIntegerParser("2")

Without semicolon, of course, because REPL is about doing things quickly.

Now you can save your workspace as workspace1:

-> /save workspace1

If you look into the workspace1 file, there are all of your commands, you can reload it with /open workspace1 anytime or just edit that file manually and carefully.

Missing features

It’s out of scope but a marriage with Maven and Gradle would be really useful. Just imagine, you would run jshell in your project’s root, jshell would parse pom.xml, deal with dependencies and load classes automatically. Wow, that would be really nice.

Tagged , , ,

Clojure quick start

I visited a London Java Community meetup where Robert Rees’d spoken about Clojure. That was a really great presentation. He mentioned that Clojure is a great choose if you need to deal with huge character streams. So I’ve just decided I have to make a text processor application based on Clojure.

Where can I start? I need some resources. I dug into the Google and found these:

http://clojure.org – official site where everything is beginning

http://tryclj.com/ – playing online with Clojure

http://planet.clojure.in/ – Clojure Community Blog

http://incanter.org/ – statistical computing platform

https://github.com/languages/Clojure – Clojure is the #24 most popular language on GitHub

And the core mailing list on Google Groups: https://groups.google.com/forum/#!forum/clojure

Tagged ,