Entries for month: September 2007

Setting Current JDK programmatically on Mac

A few days back I was looking for a way to change the CurrentJDK symbolic link on my Mac. I had found this nice script somewhere (don't quite remember where). But is is very useful.

#!/bin/sh

cd /System/Library/Frameworks/JavaVM.framework/Versions

CURJDK="`readlink CurrentJDK`"
echo Current JDK version: $CURJDK

if [ "$1" == "" ]; then
echo Installed versions:
ls
exit
fi

VERFOUND=`ls | grep $1 | head -n 1`

if [ "$VERFOUND" != "$1" ]; then
BASE="`basename $0`"
echo Error: Could not change JDK-- version $1 not installed!
echo Run $BASE without arguments to see a list of installed versions.
exit 127
fi

echo You must now enter your Mac OS X password to change the JDK.
sudo ln -fhsv $1 CurrentJDK

Save it as a file name of your choice. I saved it as "SetJDK.sh". Give it execute permissions, and run the script.

AnyEdit: useful plugin for code formatting in Flex Builder / Eclipse

Over the past few days I've been searching for a Eclipse/Flex Builder plugin that would let me trim the unnecessary spaces left at the end of lines in the code that I work on.

I found a very nice extension called AnyEdit that performs the task of trimming extra space very well. I've been using it for a few hours now and it's worked very nicely.

AnyEdit can trim trailing spaces on any text-based file type editable in Eclipse/Flex Builder Another task that the script performs very well is the ability to convert tabs in to spaces (and vice versa).

It also has some other nice features, like case conversion, chars to HTML entity conversion, etc. You can download the extension from the AnyEdit site. It's a must-have.

Adding the PATH variable on Mac OSX

This is another one of those blog entries where I want to blog for the sake of remembering tedious details...

The issue that I was facing was how to add a directory to the PATH environment variable on my Mac.

I wanted to add a path to MySQL install. So I'll use that example. The following command in a Terminal window created my .bash_profile file. If the file already exists, it would have added to that file.

echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile

The PATH information is stored in /Users/username/.bash_profile file.