Friday, August 18, 2006

Sidebar: JShell

So i'm coding away and getting increasingly frustrated with having to open multiple cmd windows (yeah, yeah i use windows) . My main crib is that I have to remember which one of the cmd's to open up for the task at hand - db server, db client, app svr or compile/jar/run :(. Papa not like!

So I think: would'nt it be nice if i had the same sort of tabbed console that those lucky linux guys have and play around with? Even better, wouldnt it be nice if ran off of the app anywhere platform - ie written in Java?

So I go looking for a java command shell - and find one in good ole sourceforge - jcmd. It has pretty much everything I want:
  • tabbed consoles
  • command history
  • restarts each console with command history on restart ( had to fix it so it did it even when you alt-f4'd the app)
But..
  • The backspace didnt work - something that I eventually found was a JDK bug in TextArea.replaceRange(). jcmd has not been updated since 2002
  • it really didnt have variable substitution. It supported env var sets, but not exactly along the lines of ${java.home}\bin\javac
So....
I'm making my own java shell - called JShell.

It uses a lot of concepts from JCmd, but is a build-from-ground-up-while-looking-at-a-good-example effort.

Right now, I have what I call the DOGFOOD release - I can use JShell to compile, jar and run itself. However, its by no means even close to working as:
  • The GUI code is just adequate - needs refactoring.
  • It has very basic keyboad handling - only enter is handled now.
  • However, it does improve on jcmd by having a grammar for the commands and I use JavaCC to generate a grammar.
  • It has very poor execution capabilities - right now it just spawns a process to exec normal OS commands, waits for the process to complete and then prints out the result
more later..

No comments: