If you want to tell the IE version during run time, you can use DesiredCapabilities.
DesiredCapabilities ieCapabilities = null;
ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setBrowserName("internet explorer");
ieCapabilities.setVersion("Version Number");
driver = new InternetExplorerDriver(ieCapabilities);
For more info about DesiredCapabilities
use this link http://code.google.com/p/selenium/wiki/DesiredCapabilities.
In the comments you said that i need both IE 8 and 9. Actually it is not possible, Windows currently supports to install only one IE version in a box. The IEDriver used the installed version of IE to launch.
If you want to use multiple version of IE to test then the better option to go with Windows Virtual Machines
. You can talk with virtual machines by using the RemoteWebdriver
instances.