When I last looked at LightTable in The Almost Unbearable Lightness of LightTable, it was kind of usable and I was working out how to configure it to work properly in my environment with dependencies. Unfortunately with 0.3, dependencies stopped working for me (but hey, it’s Alpha OK?). Now, with the release of 0.4.2 we’re “back in the LightTable room” and ready to ROCK!
So what’s changed since then and now? EVERYTHING! Literally. We still have the same very cool black default theme. It’s been possible to change the theme for a while and even create custom CSS, but I’m happy with the default minimalist one. As you can see though, the UI has improved – I like the tabs on the side – a great example of some out of the box elegant thinking.
Anyway, to getting it running… There will be a bit of duplication from my previous post, but the instructions here will be a bit tidier and customised for this new version.
If you’ve never used LightTable before (I’m assuming you have Java installed somewhere though) and have Leiningen 2 installed, then it’s too easy! Just go to www.lighttable.com, download and run!
If you have used an earlier version of LightTable then you should blow away you’re lighttable directory
rm -r ~/.lighttable
delete your current LightTable application then install and run the application.
Here, I’m assuming you’re using Clojure though where you can obviously play around to your hearts content unless you want to work with dependencies (I’ll be using an awesome Clojure framework for Swing called Seesaw in this post) which is our next step.
Let’s assume you have Leiningen 2 installed so it should again be fairly easy to get up and running, just To create a new project, you just create a default template:
lein new guitesting
Start up LightTable and connect to your project from the workspace:
If you don’t see a structure like the one on the left, then something went wrong and you may want to do some of the “cleaning” as outlined in Still not Working Huh? below. Assuming you do have this then once you’ve selected it you should be able to see your project and just need to edit your project.clj file (which is the equivalent of the dreaded Maven pom.xml file but 1E06 times more readable :)
I’ve highlighted the part where you add the dependency for seesaw – Just Ctrl/Cmd-S to save.
Now all you need is some code to test that out, so if you change your core.clj file to be
(-> (frame :title "Hello Seesaw World!"
:content "Hi, Welcome to Seesaw")
and Cmd/Ctrl-Enter to run it and you should have something like the first image on this post. If you make changes and re-run, unlike some Clojure environments that lose track of the JVM it will just bring up a separate window with your “new” app. If you want a bit more background, then you should read my post on seesaw that is a development framework for Swing GUI’s that I talked about in my previous post on Easy UI development in Clojure with Seesaw.
With dependencies working, the Clojure World with LightTable should be your oyster! :-) Go for it and feel free to let me know in the comments as I’ll quite happily update this post or create a new one referring to peoples experiences. I’ll certainly be posting more here about my adventures in LightTable ClojureLand…
Still not Working Huh?
If you’re still reading this, you’re either curious or something went wrong while you were trying to do the above. If one of the below fixes doesn’t work for you then let me know and I’ll try and help you solve it and add it to the solutions below.
Clean your Maven Directory
Whatever version of Lein you’re running it’s probably best to clean out your Maven directory:
rm -r ~/.m2/*
Then try building a project from scratch and see if that works.
Clean Installation of Lein2
Most likely it was that you’re running Lein 1 instead of 2. To check, you can just check with the following command:
$ lein -version
Leiningen 2.0.0 on Java 1.6.0_45 Java HotSpot(TM) 64-Bit Server VM
and if you get a 1.x you’re obviously running Lein 1 that is an absolute no-no. If you do get something like the above (i.e. 2.x) then you’re really in trouble and should probably let me know…
Otherwise, you’re running 1.x and LightTable won’t work with this configuration and give you all sorts of weird errors. You’ll have to upgrade, which means that you should clean out your .lein directory:
rm -r ~/.lein
Then you’ll have to do a “Bootstrap Install” of Lein2 which isn’t that hard. Firstly, remove you’re old shellscript which in my case was in my ~/bin directory that is on my Unix path:
Finally, you’ll need to get the latest and greatest version of Lein 2.0.0 – this matters, as the default when you grab it from GitHub is the 2.1-SNAPSHOT (at this time of writing) version which is on the “master” branch, but unfortunately this won’t currently work with LightTable and give you weird connection errors. I originally got this, then changed it to Stable (2.0). In my environment, everything is in ~/Gits.
The last step for this is to then install Lein2:
>> Leiningen 2.0.0 on Java 1.6.0_37 Java HotSpot(TM) 64-Bit Server VM
Note: One update I got from the previous post was from rjb / rodbiresch who says:
Nice post! I took a slightly different path by using homebrew
to pull down clojure and leiningen. One of the nice things
about homebrew is that you can easily switch versions without
having to manually clone, download, clean stuff, etc.
Again, if you manage do upgrade using homebrew let me know or even better, post a blog entry yourself and I’ll happily link to it :-)