Archive for July, 2011


How to install WebSphere 6.1 on Windows 7

Posted by anton as Websphere

Windows 7 is not officially supported by WebSphere 6.1 and the installation wizard normally breaks. However, you can still install Websphere 6.1 on Windows 7 if you use the silent installer. Follow these steps:

1. Download WAS 6.1 and unpack to C:\WAS_61 (if you unpack it elsewhere, adjust the paths in the rest of this tutorial accordingly)

2. Create a file C:\WAS_61\myoptionsfile.txt with the following contents:

-OPT silentInstallLicenseAcceptance=”true”
-OPT disableOSPrereqChecking=”true”
-OPT installType=”installNew”
-OPT feature=”noFeature”
-OPT installLocation=”C:\IBM\WebSphere 6.1\AppServer”
-OPT PROF_enableAdminSecurity=”true”
-OPT PROF_adminUserName=admin
-OPT PROF_adminPassword=admin

Modify these settings if needed. I would imagine that the installLocation will vary for most people.

3. Go to Start, search your programs and files for cmd, in the search results right-click the cmd and select Run as Administrator. This will bring up the command prompt. It is crucial to run it as administrator.

4. In command prompt, execute this command:

C:\> C:\WAS_61\WAS\install.exe -options “C:\WAS_61\myoptionsfile.txt” -silent

5. Wait until the installation finishes. Since it runs silently, it won’t notify you with a popup window or anything like that. The only two ways to check on the progress are (1) to use the Task Manager and (2) to view the log file at C:\IBM\WebSphere 6.1\AppServer\logs\install\log.txt. If you see that the last line contains the code INSTCONFSUCCESS – the installation has completed successfully.

Note: if the installation wizard fails to even start, its log file with the error message will be stored here: C:\Documents and Settings\<User>\waslogs


How to connect a new virtual disk in VMWare

Posted by anton as VMWare

Sometimes you need to manually create and attach a virtual disk to your virtual machine in VMWare. To do that, login to your machine as root and run the following commands (in bold):

[root@myserver ~]# fdisk /dev/hdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

The number of cylinders for this disk is set to 17753.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-17753, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-17753, default 17753):
Using default value 17753

Command (m for help): n Command action
   l   logical (5 or over)
   p   primary partition (1-4)
First cylinder (1-17753, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-17753, default 17753):
Using default value 17753

Command (m for help): w The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

[root@myserver ~]# mkfs -t ext3 /dev/hdb5 mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1048576 inodes, 2097057 blocks
104852 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2147483648
64 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done
Creating journal (32768 blocks):
Writing superblocks and filesystem accounting information:

This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@myserver ~]# mkdir /opt2
[root@myserver ~]# mount -t ext3 /dev/hdb5 /opt2 

Java Locales and parsing numbers

Posted by anton as Java

Original article: Understanding Locale in the Java Platform


Locale is a set of parameters that defines the user’s language, country and any special variant preferences that the user wants to see in their user interface. Usually a locale identifier consists of at least a language identifier and a region identifier. In Java, there is a third (optional) component called ‘variant’, which exists for the developers convenience to allow us to define our own locales.

Locale definition structure:


Example locales:

ende_DE es_ES_WIN es_ES_MAC

The java.util.Locale class has several constructors:

Locale(String language) Locale(String language, String country) Locale(String language, String country, String variant)

The following shows how each constructor can be used:

// Create a generic English-speaking locale.
Locale locale1 = new Locale("en");
// Create an English-speaking, Canadian locale.
Locale locale2 = new Locale("en", "CA");
// Create a very specific English-speaking, U.S. locale
// for Silicon Valley.
Locale locale3 = new Locale("en", "US", "SiliconValley");

Parsing numbers with respect to locales

An international user may input a number in their own locale. For example, a Russian user would enter a double number like so (note the comma):


When parsing such a number in your code you want to end up with a Double object. However, an important lesson here is that Java objects expect inputs in US locale. Therefore, if you were to supply this user input directly to the Double(String s) constructor, you would get an error. See the equivalent code below.


String myString =10,5;
Double myNumber = new Double(myString);


at sun.misc.FloatingDecimal.readJavaFormatString(
at java.lang.Double.valueOf(
at java.lang.Double.(
at …

In order to avoid this problem, you need to use the NumberFormatter object to correctly parse a number, which was entered in the Russian locale.

String myString = "10,5"; 
Locale locale = new Locale("ru", "RU"); 
NumberFormat format = NumberFormat.getInstance(locale); 
Number number = format.parse(myString); 
Double myNumber = new Double(number.doubleValue());

This is the correct way to parse a Double number taking the locale into account.

Printing numbers with respect to locales

In order to print a number in a localized form, you need to use the NumberFormat class. Consider this example:

Double myNumber = new Double(10.5);
System.out.println(myNumber); // prints 10.5
Locale locale_RU = new Locale(“ru”, “RU”);
System.out.println(myNumber); // still prints 10.5
NumberFormat format = NumberFormat.getInstance();
System.out.println(format.format(myNumber)); // prints 10,5

As you can see, setting the default locale to Russian is not enough to correctly print double numbers. The use if NumberFormat is still required.