SKM IT World

Just another blog about IT


1 Comment

How To Debug Groovy Script From Shell

Groovy is a scripting language, so it is possible to run Groovy code without compiling to Java byte code. The necessary condition is that Groovy is installed on your machine. Then, running a Groovy script in a shell looks like the following line.


~>groovy TestScript.groovy

Now, something is wrong with the script, only on a special environment. So you want to debug your Groovy script from the shell. Fortunately, it works for Groovy just like for Java. You only have to export the Java options for debugging.


~>export JAVA_OPTS="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y"

Now, we can debug our script running from the shell with our favorite IDE.


~>groovy TestScript.groovy
Listening for transport dt_socket at address: 4000

Advertisements


Leave a comment

Cygwin Embedded In Console2 Under Windows 7

I like to use Cygwin for having a bash shell on a windows machine. In combination with Console2 you have a powerful command-line tool for windows. I’d like to describe how to install Cygwin and Console2 under windows 7 (I think this instruction works on Windows XP, too) and how to embed Cygwin in Console2. I used for Cygwin version 1.7.17-1 32bit and for Console2 version 2.00b148-Beta_32bit.

Cygwin Installation

  1. Download setup.exe.
  2. Double click on setup.exe starts the installation.
  3. Follow the set up instruction. As installation location I use c:\cygwin.
  4. Go to c:\cygwin and run Cygwin.bat for setting up Cygwin user home etc.

Console2 Installation

  1. Download zip file.
  2. Unzip it into installation location.
  3. Start Console2 with a double click on Console2.exe.

How to embed Cygwin in Console2

  1. Open Console2.
  2. Go to Edit -> Settings.
  3. Go to  Tab
  4. In field title insert for example bash. It is the name of the first tab in Console2.
  5. In field Shell you have to insert C:\cygwin\bin\bash.exe –login -i (Don’t forget c:\cygwin is your installation folder).
  6. In field Startup dir you can insert C:\cygwin\home\user.name. This folder is used at every Console2 start.

Links

  1. Cygwin Homepage
  2. Console2 Homepage
  3. Good short feature overview of Cygwin on the Wikipedia page